File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -282,8 +282,11 @@ internal fun parseIso(isoString: String): Instant {
282
282
++ i
283
283
}
284
284
val year = when {
285
- i > yearStart + 9 -> {
286
- parseFailure(" Expected at most 9 digits for the year number, got ${i - yearStart} " )
285
+ i > yearStart + 10 -> {
286
+ parseFailure(" Expected at most 10 digits for the year number, got ${i - yearStart} " )
287
+ }
288
+ i == yearStart + 10 && s[yearStart] >= ' 2' -> {
289
+ parseFailure(" Expected at most 9 digits for the year number or year 1000000000, got ${i - yearStart} " )
287
290
}
288
291
i - yearStart < 4 -> {
289
292
parseFailure(" The year number must be padded to 4 digits, got ${i - yearStart} digits" )
Original file line number Diff line number Diff line change @@ -372,7 +372,7 @@ class InstantIsoStringsTest {
372
372
Instant .DISTANT_FUTURE ,
373
373
Instant .DISTANT_PAST ,
374
374
Instant .fromEpochSeconds(0 , 0 ),
375
- Instant .parse (" 2020-01-02T03:04:05.6789Z" ),
375
+ parseInstant (" 2020-01-02T03:04:05.6789Z" ),
376
376
Instant .MAX ,
377
377
Instant .MIN ,
378
378
)
@@ -392,7 +392,7 @@ class InstantIsoStringsTest {
392
392
if (instant == Instant .MAX && offsetSeconds < 0 ||
393
393
instant == Instant .MIN && offsetSeconds > 0
394
394
) continue
395
- val newInstant = Instant .parse (" ${instant.toString().dropLast(1 )}$offsetString " )
395
+ val newInstant = parseInstant (" ${instant.toString().dropLast(1 )}$offsetString " )
396
396
assertEquals(newInstant, instant.minus(offsetSeconds.seconds))
397
397
}
398
398
}
You can’t perform that action at this time.
0 commit comments