Skip to content

Conversation

@kylef
Copy link
Contributor

@kylef kylef commented Apr 30, 2021

This adds tests for the date format to ensure that the month day-length is permitted following the day restrictions, there is 2 tests for each month (one at last day and one negative at day after). February has two sets of tests for normal and leap years.

5.7. Restrictions

The grammar element date-mday represents the day number within the
current month. The maximum value varies based on the month and year
as follows:

  Month Number  Month/Year           Maximum value of date-mday
  ------------  ----------           --------------------------
  01            January              31
  02            February, normal     28
  02            February, leap year  29
  03            March                31
  04            April                30
  05            May                  31
  06            June                 30
  07            July                 31
  08            August               31
  09            September            30
  10            October              31
  11            November             30
  12            December             31

Appendix C contains sample C code to determine if a year is a leap
year.

There contains a test for invalid months too.

@Julian
Copy link
Member

Julian commented Jun 15, 2021

Thank you! Think these all seem great. Sincere apologies for the delay.

@Julian Julian merged commit 4d65d2d into json-schema-org:master Jun 15, 2021
@kylef kylef deleted the kylef/date branch June 15, 2021 07:37
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