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

Problem validating inputs min/max of type "datetime-local" #1372

Open
2 of 3 tasks
victornoleto opened this issue Jul 28, 2023 · 2 comments
Open
2 of 3 tasks

Problem validating inputs min/max of type "datetime-local" #1372

victornoleto opened this issue Jul 28, 2023 · 2 comments

Comments

@victornoleto
Copy link

What kind of issue is this? (put 'x' between the square brackets)

I'm developing a linked dates component and for that I would like to use the native date and time selection inputs, datetime-local.

The objective is that in the change event of the "start input", this value is set in the "min" attribute of the "end input". And likewise, in the change event the "end input", the value is set in the "max" attribute of the "start input".

I do this to take advantage of the component's native behavior that blocks the selection of some dates according to the min/max fields. This is working wonderfully.

The problem comes from how parsley uses the min and max attributes. Because (and I can't figure out why) it can't correctly validate if one date is less/greater than another in the format this native input uses, "YYYY-MM-DDTHH:mm".

In the images below I exemplify what happened.

The code:
2023-07-28_13-50

The generated output:
2023-07-28_13-50_1

Start input limited to dates below than "2023-07-20T10:00"
2023-07-28_13-50_2

End input limited to dates higher than "2023-07-10T10:00"
2023-07-28_13-50_3

The error:
2023-07-28_13-50_4]

@marcandre
Copy link
Collaborator

Thanks for the detailed report. I agree this looks like a bug. Do you have a codepen or similar I could look at?

@victornoleto
Copy link
Author

Thanks for the detailed report. I agree this looks like a bug. Do you have a codepen or similar I could look at?

Sure! Here is it: https://jsfiddle.net/victorsysout/93sfoLmh/25/

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

No branches or pull requests

2 participants