Hi all,
when using a input_datetime
helper in the UI, it now consists of two seperate input textfields. I request a change the input to one single text input, which can contain any format regarding the settings of the input (time, date, both). This is more user friendly, easier to style and better for accessibility.
Example:
input_datetime
time only to show military 15:00:00
would accept input:
1500, 3pm, 300pm, 0300pm, 15
input_datetime
date only to show military 2024-04-23
would accept input:
23 april 2024, 23-04-24, 24-04-23, 2024-04-23, 23rd of april this year and many more.
input_datetime
date and time would be a combination of both.
I looked around and the file to change is the ha-base-time-input.ts
. I also used the internet and figured this can be done by using regex patterns like so:
const timePattern = /^(\d{1,2}:\d{2}(?::\d{2}(?:\.\d{1,6})?)?)$/;
const datePattern = /^\d{4}-\d{2}-\d{2}$/;
const dateTimePattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,6})?)?Z?$/;
Unfortunatly, I am not capable (yet) of changing this code without breaking it.
Kind regards
Douwe