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

View File

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

View File

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

View File

@ -82,8 +82,8 @@
},
"UNITS": {
"LABEL": "Unités pour les distances",
"IMPERIAL": "Système impérial (ft, mi)",
"METRIC": "Système métrique (m, km)"
"IMPERIAL": "Système impérial (ft, mi, °F)",
"METRIC": "Système métrique (m, km, °C)"
},
"SPORT": {
"ACTION": "action",
@ -108,4 +108,4 @@
"USER_PICTURE": "photo de l'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."
}
}