Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vinhill opened this issue Jul 22, 2024 · 2 comments
Open

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

vinhill opened this issue Jul 22, 2024 · 2 comments

Comments

@vinhill
Copy link
Contributor

vinhill commented Jul 22, 2024

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?

@ZohaiAli

This comment was marked as spam.

@annevk
Copy link
Member

annevk commented Aug 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants