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

restrict month day numbers in date formats #96

Merged
merged 1 commit into from
Dec 30, 2024
Merged

restrict month day numbers in date formats #96

merged 1 commit into from
Dec 30, 2024

Conversation

mmoskal
Copy link
Collaborator

@mmoskal mmoskal commented Dec 17, 2024

we could also check for leap year as well, there is the following in JsonSchemaStore ci.json:

"released_at": {
              "type": "string",
              "description": "The date and time when the release is ready. Defaults to the current date and time if not defined. Should be enclosed in quotes and expressed in ISO 8601 format.",
              "format": "date-time",
              "pattern": "^(?:[1-9]\\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\\d|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[1-9]\\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)-02-29)T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:Z|[+-][01]\\d:[0-5]\\d)$"
            },

but I think this will do for now

seems to pass the tests

@mmoskal mmoskal requested a review from hudson-ai December 17, 2024 16:23
@mmoskal
Copy link
Collaborator Author

mmoskal commented Dec 24, 2024

@hudson-ai ping?

@hudson-ai
Copy link
Collaborator

Oh, my apologies for missing this PR! Will take a look and see how it changes coverage of the JSON Schema test suite date/datetime format tests. Is there a similar regex you can find for time?

@mmoskal
Copy link
Collaborator Author

mmoskal commented Dec 25, 2024

I didn't get failures for time. Should be slightly better for the test suite.

@hudson-ai
Copy link
Collaborator

Looks great!

@hudson-ai hudson-ai merged commit dbe1735 into main Dec 30, 2024
1 check passed
@hudson-ai hudson-ai deleted the date_format branch December 30, 2024 18:18
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

Successfully merging this pull request may close these issues.

2 participants