Skip to content

Leap seconds are handled even better (#508) #525

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

Merged
merged 1 commit into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<version.mockito>2.7.21</version.mockito>
<version.hamcrest>2.2</version.hamcrest>
<version.undertow>2.2.14.Final</version.undertow>
<version.itu>1.3.0</version.itu>
<version.itu>1.5.1</version.itu>
</properties>
<dependencies>
<dependency>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/networknt/schema/DateTimeValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ private boolean isLegalDateTime(String string) {
return tryParse(() -> {
try {
ITU.parseDateTime(string);
} catch (LeapSecondException ignored) {}
} catch (LeapSecondException ex) {
if(!ex.isVerifiedValidLeapYearMonth()) {
throw ex;
}
}
});
} else {
throw new IllegalStateException("Unknown format: " + formatName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
{
"description": "an invalid date-time string with leap second",
"data": "1998-10-31T23:59:60Z",
"data": "1997-12-31T23:59:60Z",
"valid": false
}
]
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/draft7/optional/format/date-time.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
{
"description": "an invalid date-time string with leap second",
"data": "1998-10-31T23:59:60Z",
"data": "1997-12-31T23:59:60Z",
"valid": false
}
]
Expand Down