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
Fix 'step', 'min' & 'max' controls on date/time inputs #2119
base: master
Are you sure you want to change the base?
Conversation
A good first step would be to answer all the questions inside the PR description. Atm this code changes are useless. |
Done, i hope that is ok for you ;). |
This issue/proposal has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. |
Could this be reopened again as it is basically solved? |
Sorry for this. I'll reopen it and will try to review it when I got some free time. |
Can this please be fixed |
@khansamad47 what exact problem do you see and does this fix provided here solve it? |
In what state is this issue? Can it be fixed? |
I'm seeing that this desperately needs tests to move forward. Sadly, tests were never added to this PR, per requested checklist in PR summary:
When I went to test this using Drupal's Clientside Validation module via patch adapted from the code in this pr, I immediately hit an issue where a date field should clearly pass, but fails. Relevant HTML snippet from Drupal, that could be adapted/simplified into a test case: Min/Max is not calculated correctly:
<input
type="date"
placeholder="YYYY-MM-DD"
min="1902-01-01"
max="2037-12-31"
name="date"
value="2022-02-22"
size="12"
/>
<input
type="time"
step="1"
placeholder="hh:mm:ss"
name="time"
value="09:14:19"
size="12"
/> I've setup a very complete jsbin to compare native html5 validation with each date type that demonstrates several issues related to min/max calculations and breakage due to the "step" attribute. |
It's been a couple years, @ElGigi . Have you had a chance to revisit this? |
I tried to fix it, but unfortunately I no longer use the library since I no longer use jQuery. |
Checklist for this pull request
Before submitting a pull request, please make sure to follow these rules:
Description
In reference to issue: #2023
It's a solution for jquery-validation to support attributes: 'step', 'min' and 'max' on inputs of type : 'time', 'date', 'datetime', 'datetime-local', 'month' and 'week'.
It respond to:
jquery-validation/src/core.js
Line 1463 in 6ff4a02
Specifications: https://html.spec.whatwg.org/multipage/input.html#local-date-and-time-state-(type%3Ddatetime-local)