diff --git a/assets/js/components/LimitSocSelect.vue b/assets/js/components/LimitSocSelect.vue index 135323644..ac3adcbfb 100644 --- a/assets/js/components/LimitSocSelect.vue +++ b/assets/js/components/LimitSocSelect.vue @@ -65,8 +65,7 @@ export default { return null; }, formatSoc: function (value) { - // todo: add fahrenheit support - return this.heating ? this.fmtNumber(value, 1, "celsius") : `${Math.round(value)}%`; + return this.heating ? this.fmtTemperature(value) : `${Math.round(value)}%`; }, formatKm: function (value) { return `${this.fmtNumber(value, 0)} ${distanceUnit()}`; diff --git a/assets/js/components/Vehicle.vue b/assets/js/components/Vehicle.vue index ebc4d3b44..a7424265d 100644 --- a/assets/js/components/Vehicle.vue +++ b/assets/js/components/Vehicle.vue @@ -155,8 +155,7 @@ export default { return "--"; } if (this.heating) { - // todo: add celsius/fahrenheit option to ui - return this.fmtNumber(this.vehicleSoc, 1, "celsius"); + return this.fmtTemperature(this.vehicleSoc); } return `${Math.round(this.vehicleSoc)}%`; }, diff --git a/assets/js/mixins/formatter.js b/assets/js/mixins/formatter.js index 6d77b5369..df7f1fcab 100644 --- a/assets/js/mixins/formatter.js +++ b/assets/js/mixins/formatter.js @@ -238,12 +238,16 @@ export default { return rtf.format(Math.round(elapsed / units[u]), u); }, fmtSocOption: function (soc, rangePerSoc, distanceUnit, heating) { - let result = heating ? this.fmtNumber(soc, 1, "celcius") : `${this.fmtNumber(soc, 0)}%`; + let result = heating ? this.fmtTemperature(soc) : `${this.fmtNumber(soc, 0)}%`; if (rangePerSoc && distanceUnit) { const range = soc * rangePerSoc; result += ` (${this.fmtNumber(range, 0)} ${distanceUnit})`; } return result; }, + fmtTemperature: function (value) { + // TODO: handle fahrenheit + return this.fmtNumber(value, 1, "celsius"); + }, }, };