Skip to content

Commit 1c68e2c

Browse files
aznan2Matti Hansson
and
Matti Hansson
authored
Leap seconds are handled even better (#508) (#525)
Co-authored-by: Matti Hansson <[email protected]>
1 parent 9af96e8 commit 1c68e2c

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<version.mockito>2.7.21</version.mockito>
7272
<version.hamcrest>2.2</version.hamcrest>
7373
<version.undertow>2.2.14.Final</version.undertow>
74-
<version.itu>1.3.0</version.itu>
74+
<version.itu>1.5.1</version.itu>
7575
</properties>
7676
<dependencies>
7777
<dependency>

src/main/java/com/networknt/schema/DateTimeValidator.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ private boolean isLegalDateTime(String string) {
6565
return tryParse(() -> {
6666
try {
6767
ITU.parseDateTime(string);
68-
} catch (LeapSecondException ignored) {}
68+
} catch (LeapSecondException ex) {
69+
if(!ex.isVerifiedValidLeapYearMonth()) {
70+
throw ex;
71+
}
72+
}
6973
});
7074
} else {
7175
throw new IllegalStateException("Unknown format: " + formatName);

src/test/resources/draft2019-09/optional/format/date-time.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
},
7373
{
7474
"description": "an invalid date-time string with leap second",
75-
"data": "1998-10-31T23:59:60Z",
75+
"data": "1997-12-31T23:59:60Z",
7676
"valid": false
7777
}
7878
]

src/test/resources/draft7/optional/format/date-time.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
},
7373
{
7474
"description": "an invalid date-time string with leap second",
75-
"data": "1998-10-31T23:59:60Z",
75+
"data": "1997-12-31T23:59:60Z",
7676
"valid": false
7777
}
7878
]

0 commit comments

Comments
 (0)