Skip to content

Commit

Permalink
fix: last_updated date format was not following the configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed Apr 19, 2022
1 parent 7751009 commit 3dd4904
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/ui-lovelace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ views:
floating: true

- type: custom:apexcharts-card
show:
last_updated: true
update_interval: 2s
stacked: true
experimental:
Expand Down
5 changes: 2 additions & 3 deletions src/apexcharts-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
decompress,
getPercentFromValue,
interpolateColor,
is12Hour,
log,
mergeConfigTemplates,
mergeDeep,
Expand Down Expand Up @@ -686,9 +687,7 @@ class ChartsCard extends LitElement {
if (this._config?.show?.last_updated) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let hours12: any = undefined;
if (this._config.hours_12 !== undefined) {
hours12 = this._config.hours_12 ? { hour12: true } : { hourCycle: 'h23' };
}
hours12 = is12Hour(this._config, this._hass) ? { hour12: true } : { hourCycle: 'h23' };
const lastUpdated = new Intl.DateTimeFormat(this._config.locale || this._hass?.language || 'en', {
year: 'numeric',
month: 'short',
Expand Down

0 comments on commit 3dd4904

Please sign in to comment.