-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
datetime validation fails if seconds are missing #3636
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
Comments
I have the same issue. |
Likewise. I'm using js-joda to handle dates, and its |
I've noticed the same issue with Hopefully this can be fixed sometime soon |
An option to toggle between |
At first I was open to write a PR to implement it but the documentation specifies that the |
@fvilers But a ISO time format is also valid without the seconds, and it's the way that browsers return the date in a valid ISO format, but the validation in the library tells us it's wrong. Going for a regex here, instead of fixing a obvious bug in this library, that many people have (see all the up-votes), seems to be kinda hack or a workaround, but not solving the problem. |
@u2ix As I'm reading https://en.wikipedia.org/wiki/ISO_8601#Times you might be right. It looks like the seconds could be omitted. I might create a PR to add this feature (an approval from the maintainer(s) would be great). Using a regex is not hacky as it's what is used behind the scenes by the |
Pleeease fix this annoying issue (not bug).. I think a modern library should handle without seconds. |
Same here. input with datetime-local type fails zod validation. For my use case, I had to break down my input in 2 parts: time and date. Waiting for some update here. Thanks ahead |
Hi all, I was also running into the same issue, so I've submitted a PR for this change (#4315). |
Landed in 3.24.4 |
Have an issue with a valid datetime value, as produced by the browser in a datetime picker field, is not accepted by the
datetime()
validation. After some digging I figured that when the seconds:00
are added the validation passes.But according to ISO 8601, just the hour is required for a valid time. Also as the timestamp is produced like this
"2024-07-18T11:00"
, I feel it would be really great if this is accepted by the library as also the Date constructor doesn't have any issue with this.For now I had to put in a quite ugly
preprocess
to make the validation pass on the value provided by the browser:The text was updated successfully, but these errors were encountered: