Skip to content

A number of bugs and inconsistencies with Java #443

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

Closed
4 of 8 tasks
dkhalanskyjb opened this issue Oct 15, 2024 · 1 comment · Fixed by #447
Closed
4 of 8 tasks

A number of bugs and inconsistencies with Java #443

dkhalanskyjb opened this issue Oct 15, 2024 · 1 comment · Fixed by #447
Labels
formatters Related to parsing and formatting

Comments

@dkhalanskyjb
Copy link
Collaborator

dkhalanskyjb commented Oct 15, 2024

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 for LocalDateTime): 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 just P without any components, so we should probably fix that.
  • kotlinx.datetime.DatePeriod is always normalized unlike java.time.Duration`: this is intentional.
  • kotlinx.datetime.Instant.parse: intentional.
  • Different periods between two dates in Java and Kotlin: looks like Java's bug.
  • 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 think PT0000000000000000000000000M is 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)
@dkhalanskyjb
Copy link
Collaborator Author

JetBrains/kotlin#5370 is the kotlin.time.Duration portion of the fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatters Related to parsing and formatting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant