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

Fix 'step', 'min' & 'max' controls on date/time inputs #2119

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ElGigi
Copy link

@ElGigi ElGigi commented Dec 14, 2017

Checklist for this pull request

Before submitting a pull request, please make sure to follow these rules:

  • Your code should contain tests relevant for the problem you are solving.
  • Your commits messages format should follow the jQuery git commit message format (http://contribute.jquery.org/commits-and-pull-requests/#commit-guidelines).
  • The pull request should reference existing issues or link to a reproducible demo.
  • Please review the guidelines for contributing (CONTRIBUTING.md) to this repository for more information.

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:

// TODO find a way to support input types date, datetime, datetime-local, month, time and week

Specifications: https://html.spec.whatwg.org/multipage/input.html#local-date-and-time-state-(type%3Ddatetime-local)

@staabm
Copy link
Member

staabm commented Dec 14, 2017

A good first step would be to answer all the questions inside the PR description.

Atm this code changes are useless.

@ElGigi
Copy link
Author

ElGigi commented Dec 15, 2017

Done, i hope that is ok for you ;).

@stale
Copy link

stale bot commented Jun 5, 2018

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.
Thank you for contributing :)

@stale stale bot added the stale Used to mark stale issues label Jun 5, 2018
@stale stale bot closed this Jun 12, 2018
@derkaiserreich
Copy link

Could this be reopened again as it is basically solved?

@Arkni
Copy link
Member

Arkni commented Jun 14, 2018

Sorry for this. I'll reopen it and will try to review it when I got some free time.

@Arkni Arkni reopened this Jun 14, 2018
@stale stale bot removed the stale Used to mark stale issues label Jun 14, 2018
@khansamad47
Copy link

Can this please be fixed

@staabm
Copy link
Member

staabm commented Oct 21, 2018

@khansamad47 what exact problem do you see and does this fix provided here solve it?

@Tomanlu
Copy link

Tomanlu commented Dec 4, 2019

In what state is this issue? Can it be fixed?

@jameswilson
Copy link

jameswilson commented Feb 23, 2022

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:

Your code should contain tests relevant for the problem you are solving.

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.

Screen Shot 2022-02-22 at 11 54 13 AM

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.

https://jsfiddle.net/w8jpygr2/

@omahane
Copy link

omahane commented Mar 14, 2024

It's been a couple years, @ElGigi . Have you had a chance to revisit this?

@ElGigi
Copy link
Author

ElGigi commented Mar 15, 2024

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.

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

Successfully merging this pull request may close these issues.

None yet

8 participants