Skip to content

Commit

Permalink
format temperature per locale
Browse files Browse the repository at this point in the history
  • Loading branch information
decompil3d authored Jul 1, 2022
1 parent a4640c0 commit 6979a71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/hourly-weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
handleAction,
LovelaceCardEditor,
getLovelace,
formatNumber,
formatTime,
FrontendLocaleData,
} from 'custom-card-helpers'; // This is a community maintained npm module with common helper functions/types. https://github.com/custom-cards/custom-card-helpers
Expand Down Expand Up @@ -96,7 +97,7 @@ export class HourlyWeatherCard extends LitElement {
const conditionList = this.getConditionListFromForecast(forecast, numHours);
const temperatures: HourTemperature[] = forecast.map(fh => ({
hour: this.formatHour(new Date(fh.datetime), this.hass.locale),
temperature: fh.temperature
temperature: formatNumber(fh.temperature, this.hass.locale)
}));
temperatures.length = numHours;

Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ export type ConditionSpan = [

export interface HourTemperature {
hour: string,
temperature: number
temperature: string
}

0 comments on commit 6979a71

Please sign in to comment.