Skip to content

Make admissible ranges the same on all platforms #432

Open
@dkhalanskyjb

Description

Create a giant local date on a JVM server:

java.time.LocalDate.MAX.toKotlinLocalDate()

Send it over the network to a Native client. Parsing this date will fail.

Why? The reason is that LocalDate, LocalDateTime, and Instant have different platform-specific ranges on different platforms.

It may be surprising that some values produced, then serialized and deserialized purely by the code in our library fail to work on the same version of our library on a different platform.

The proposal: align all platform-specific ranges to be the same.

Cons:

  • Slightly less efficient implementation.
  • The enormous dates and instants are hard to come by: on Native, the range is generous -1000000..1000000 years, enough for all realistic use cases. Java-specific sentinel values are the one exception.

Metadata

Assignees

No one assigned

    Labels

    breaking changeThis could break existing code

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions