Replace date picker for entities card#6899
Conversation
2018974 to
24d20e9
Compare
57a5340 to
b72f898
Compare
| this.i18n.formatDate = this._formatISODate; | ||
| this.i18n.parseDate = this._parseISODate; |
There was a problem hiding this comment.
We should show the date in the format of the user language, we have functions for that: https://github.com/home-assistant/frontend/blob/dev/src/common/datetime/format_date.ts#L4
There was a problem hiding this comment.
Something like formatDateShort(new Date(d.year, d.month, d.day), this.hass.language)
|
And can someone remind me why we can't use |
|
Maybe because it might look old or bad on some devices? Also not everything supports it. |
|
Fuck safari, let them have text inputs 😛 but then we can't parse that to a date object because safari only accepts ISO 8601 strings.... |
|
I don't understand why they have to make literally everything so Difficult |
|
It's weird that we don't have a |
…rd. Also make it ISO compliant.
b72f898 to
8a1d3b5
Compare
|
Parsing date strings according to locale seems way harder than you'd think at first glance. Especially since we allow several formats for this; DD, MM-DD, YY-MM-DD and YYYY-MM-DD. |
|
There's still an annoying 5 px difference in alignment between date and time numbers, but I didn't want to ugly-hack it away, and anything better would require getting more vaadin stuff imported - which I believe we try to avoid? The date picker is used here because we already had it anyway. |
This reverts commit cae7d8d.



Proposed change
Type of change
Use the vaadin-date-picker we already have for input_datetime in the entities card too.
I made a wrapper to make is ISO compliant and change the formating a bit so it looks more like the paper-input used for time inputs.
I also replaced the date picker in the more-info dialog with the wrapped version.

Finally fixes #4866.
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: