html icon indicating copy to clipboard operation
html copied to clipboard

How to convert negative number to a time string in stepDown?

Open vinhill opened this issue 1 year ago • 2 comments

What is the issue with the HTML Standard?

Consider invoking stepDown for <input type=time max=17:00 step=900>. Blink sets the value to 00:00 while Gecko computes 23:45.

According to stepDown, we subtract 15 minutes from zero obtaining a negative value. The element has no minimum and -00:15 is less than 17:00. In step 11 we then determine the new element value as

a valid time string that represents the time that is input milliseconds after midnight on a day with no time changes

see here.

Maybe time input elements should have a default minimum of zero and default maximum of 23:59?

vinhill avatar Jul 22 '24 12:07 vinhill

i can help you if you want

ZohaiAli avatar Aug 04 '24 15:08 ZohaiAli

This problem would also arise if there was no max attribute, right?

Although I suppose the max attribute raises the question of whether 16:45 could be a reasonable answer. (I actually think that it would be, but that matches nobody and might be tricky to define.)

It also seems that valueAsNumber can enter this same code path so we have to deal with negative values here somehow anyway.

cc @whatwg/forms

annevk avatar Aug 14 '24 15:08 annevk