mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-16 22:06:34 +00:00
Use current date for input_datetime time rendering (#754)
* Use current date for input_datetime time rendering Chrome has a bug where it fails to render times correctly using toLocaleTimeString for certain dates in the past with non-normal daylight saving rules. For the UK and New Zealand, this includes 1970-01-01. Instead of using this as the date when rendering the time for a time only input_datetime, use the current date. * Add comment * Lint
This commit is contained in:
parent
27d343b488
commit
1d13126bb5
@ -27,8 +27,11 @@ export default function computeStateDisplay(localize, stateObj, language) {
|
||||
);
|
||||
stateObj._stateDisplay = formatDate(date, language);
|
||||
} else if (!stateObj.attributes.has_date) {
|
||||
const now = new Date();
|
||||
date = new Date(
|
||||
1970, 0, 1,
|
||||
// Due to bugs.chromium.org/p/chromium/issues/detail?id=797548
|
||||
// don't use artificial 1970 year.
|
||||
now.getFullYear(), now.getMonth(), now.getDay(),
|
||||
stateObj.attributes.hour,
|
||||
stateObj.attributes.minute
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user