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

date-time accept timestamp without time zone #70

Open
kaneda-san opened this issue Jul 6, 2022 · 2 comments
Open

date-time accept timestamp without time zone #70

kaneda-san opened this issue Jul 6, 2022 · 2 comments

Comments

@kaneda-san
Copy link

kaneda-san commented Jul 6, 2022

According to ajv-formats documentation, "date-time" format specify that time-zone is mandatory. Unfortunately since full validation mode format has been added, it seems that time-zone is not mandatory anymore:

import ajvFormats from "ajv-formats"

const dateWithoutTimeZone = '2022-07-06T13:12:43';
const dateWithTimeZone = '2022-07-06T13:12:43Z';

// validation with new full format mode does not work as expected
console.log(ajvFormats.get("date-time").validate(dateWithoutTimeZone)) // true => should return false
console.log(ajvFormats.get("date-time").validate(dateWithTimeZone)) // true => ok

// validation with fast format mode is ok
console.log(new RegExp(ajvFormats.get("date-time", "fast").validate).test(dateWithoutTimeZone)) // false => ok
console.log(new RegExp(ajvFormats.get("date-time", "fast").validate).test(dateWithTimeZone)) // true => ok
@kaneda-san
Copy link
Author

If you confirm the issue, I could propose a pull request.

@thobson
Copy link

thobson commented Sep 24, 2022

Same issue for me, but it's fixed in v3.0.0-rc.0

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

No branches or pull requests

2 participants