Skip to content

Commit

Permalink
fix: Time would sometime display 24:xx instead of 00:xx [kalkih#536]
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider authored and jlsjonas committed Jan 22, 2022
1 parent 5785bd8 commit 7c7d921
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/buildConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export default (config) => {
conf.color_thresholds_transition,
);
const additional = conf.hours_to_show > 24 ? { day: 'numeric', weekday: 'short' } : {};
conf.format = { hour12: !conf.hour24, ...additional };
const hourFormat = conf.hour24 ? { hourCycle: 'h23' } : { hour12: true };
conf.format = { ...hourFormat, ...additional };

// override points per hour to mach group_by function
switch (conf.group_by) {
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ class MiniGraphCard extends LitElement {

const oneMinInHours = 1 / 60;
now.setMilliseconds(now.getMilliseconds() - getMilli(offset * id + oneMinInHours));
const end = getTime(now, { hour12: !this.config.hour24 }, this._hass.language);
const end = getTime(now, format, this._hass.language);
now.setMilliseconds(now.getMilliseconds() - getMilli(offset - oneMinInHours));
const start = getTime(now, format, this._hass.language);

Expand Down

0 comments on commit 7c7d921

Please sign in to comment.