kotlinx-datetime
kotlinx-datetime copied to clipboard
A number of bugs and inconsistencies with Java
https://gist.github.com/ilma4/a5ad5b5c284969e24f4e2149a2f8b273 lists several bugs and inconsistencies.
- [ ]
kotlinx.datetime.LocalDate.parse(s) vs LocalDate.Formats.ISO.parse(s)(and the same forLocalDateTime): Java's facilities don't support having too many leading zeroes, but our parsing mechanism does, and delegating to Java prevents us from reading strings like+00000000000002022-07-16. - [ ]
DatePeriod.parse and DateTimePeriod.parse parsing "P": it is inconsistent with ISO 8601 to parse justPwithout any components, so we should probably fix that. - [x]
kotlinx.datetime.DatePeriod is always normalized unlikejava.time.Duration`: this is intentional. - [x]
kotlinx.datetime.Instant.parse: intentional. - [x]
Different periods between two dates in Java and Kotlin: looks like Java's bug. - [x]
kotlin.datetime.Duration max value is different from Java's: intentional. - [ ]
kotlin.time.Duration.parseIsoString with too many digits: it is a bug that we thinkPT0000000000000000000000000Mis an infinite duration. (Not this library's scope, though) - [ ]
kotlin.time.Duration.parse("PT+-2H") successfully parses -2 hours: not valid ISO 8601, we can fix that. (Not this library's scope, though)
https://github.com/JetBrains/kotlin/pull/5370 is the kotlin.time.Duration portion of the fixes.