Customize weather temperature display based on unit setting

This commit is contained in:
Joshua Taillon 2022-11-07 14:52:21 -07:00
parent 951dde5334
commit 0931dfc5b1
4 changed files with 18 additions and 10 deletions

View File

@ -58,10 +58,14 @@
/> />
</td> </td>
<td> <td>
{{ Number(workoutObject.weatherStart.temperature).toFixed(1) }}°C {{ useImperialUnits ?
convertCelsiusToFahrenheit(Number(workoutObject.weatherStart.temperature)).toFixed(1) + " °F" :
Number(workoutObject.weatherStart.temperature).toFixed(1) + " °C"}}
</td> </td>
<td> <td>
{{ Number(workoutObject.weatherEnd.temperature).toFixed(1) }}°C {{ useImperialUnits ?
convertCelsiusToFahrenheit(Number(workoutObject.weatherEnd.temperature)).toFixed(1) + " °F" :
Number(workoutObject.weatherEnd.temperature).toFixed(1) + " °C"}}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -120,6 +124,10 @@
const props = defineProps<Props>() const props = defineProps<Props>()
const { useImperialUnits, workoutObject } = toRefs(props) const { useImperialUnits, workoutObject } = toRefs(props)
function convertCelsiusToFahrenheit(celsius_temp: number): number {
return celsius_temp * 1.8 + 32
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -94,8 +94,8 @@
"SUCCESSFUL_UPDATE": "Dein Konto wurde erfolgreich aktualisiert.", "SUCCESSFUL_UPDATE": "Dein Konto wurde erfolgreich aktualisiert.",
"UNITS": { "UNITS": {
"LABEL": "Einheiten für die Distanz", "LABEL": "Einheiten für die Distanz",
"IMPERIAL": "Imperiales System (ft, mi)", "IMPERIAL": "Imperiales System (ft, mi, °F)",
"METRIC": "Metrisches System (m, km)" "METRIC": "Metrisches System (m, km, °C)"
}, },
"TIMEZONE": "Zeitzone" "TIMEZONE": "Zeitzone"
}, },

View File

@ -94,8 +94,8 @@
"SUCCESSFUL_UPDATE": "Your account has been updated successfully.", "SUCCESSFUL_UPDATE": "Your account has been updated successfully.",
"UNITS": { "UNITS": {
"LABEL": "Units for distance", "LABEL": "Units for distance",
"IMPERIAL": "Imperial system (ft, mi)", "IMPERIAL": "Imperial system (ft, mi, °F)",
"METRIC": "Metric system (m, km)" "METRIC": "Metric system (m, km, °C)"
}, },
"TIMEZONE": "Timezone" "TIMEZONE": "Timezone"
}, },
@ -108,4 +108,4 @@
"USER_PICTURE": "user picture", "USER_PICTURE": "user picture",
"USERNAME": "Username", "USERNAME": "Username",
"USERNAME_INFO": "3 to 30 characters required, only alphanumeric characters and the underscore character \"_\" allowed." "USERNAME_INFO": "3 to 30 characters required, only alphanumeric characters and the underscore character \"_\" allowed."
} }

View File

@ -82,8 +82,8 @@
}, },
"UNITS": { "UNITS": {
"LABEL": "Unités pour les distances", "LABEL": "Unités pour les distances",
"IMPERIAL": "Système impérial (ft, mi)", "IMPERIAL": "Système impérial (ft, mi, °F)",
"METRIC": "Système métrique (m, km)" "METRIC": "Système métrique (m, km, °C)"
}, },
"SPORT": { "SPORT": {
"ACTION": "action", "ACTION": "action",
@ -108,4 +108,4 @@
"USER_PICTURE": "photo de l'utilisateur", "USER_PICTURE": "photo de l'utilisateur",
"USERNAME": "Nom d'utilisateur", "USERNAME": "Nom d'utilisateur",
"USERNAME_INFO": "3 à 30 caractères requis, seuls les caractères alphanumériques et le caractère _ sont autorisés." "USERNAME_INFO": "3 à 30 caractères requis, seuls les caractères alphanumériques et le caractère _ sont autorisés."
} }