HTML behavior for input type "date" and "time" on Safari

Hello,

I'm working for an IT company which edit Web apps and we use HTML tags <input /> with type="date" and type="time". Actually, we've got different problems on Safari (what I read was that these problems appeared with Safari 16).

For <input type="date"/> and <input type="time"/>, the User Agent of Safari create <div> tags inside <input/> tags (with pseudo-class "-webkit-datetime-edit-day-field" for instance) to display "ghost"/faked data when the <input/> value is empty or NULL (in fact, Safari display the current date, in the local format, in <input type="date"/>). This behavior is really problematical for us because these inputs don't have to be filled every time (they are not required and don't have the attribute "required"), but they appear filled to our users... When you submit the form, the value is really empty (no value returned and that is what we want) but "something" is always displayed. We found a CSS trick to hide these things to our users but I think it's not normal, isn't it ? Can we block this Safari behavior ?

Second problem : for <input type="time"/>, they are not editable anymore if their value is empty (we detect it thursday, April 6th 2023). However, if we put a specific value when we load the page, then we delete this value in the form, and then we change the value without loosing the focus of the input, it works. If we loose the focus, we can't click on the input to change its value or something else. Do you know the reason why ? For now, we are forced to change the type of these inputs to type="text" when users are on Safari in Javascript... Nevertheless, the official documentation (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date and https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time) talks about compatibility between <input type="time"/> and Safari. Any idea ?

Thank you for your time.

This is still an issue. Has there been an update on this behavior?

Still a problem of having <input type=date> appear to have current date filled in when in fact the value is "". Don't know about other stuff.

But originally I found this page while looking into the issue of <input type=date> not submitting the form on Enter/Return.

Same here. The behavior shouldn't be like that. Safari should NOT display the current date as default value when there is no value. No value is no value, not today's date.

HTML behavior for input type "date" and "time" on Safari
 
 
Q