-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
As the documentation states, the function LocalDateTime.toInstant(timeZone: TimeZone) can be ambiguous.
Returns an instant that corresponds to this civil date/time value in the specified timeZone.
Note that the conversion is not always well-defined. There can be the following possible situations:
- There's only one instant that has this date/time value in the timeZone. In this case, the conversion is unambiguous.
- There's no instant that has this date/time value in the timeZone. Such a situation appears when the time zone experiences a transition from a lesser to a greater offset. In this case, the conversion is performed with the lesser (earlier) offset, as if the time gap didn't occur yet.
- There are two possible instants that can have this date/time components in the timeZone. In this case, the earlier instant is returned.
I would be greatly helped by a function that returns all the instants that correspond to the LocalDateTime in the specified time zone. For example something with the following signature:
fun LocalDateTime.toInstants(timeZone: TimeZone): List<Instant>If there is no such instant, the resulting list would be empty.
Would you consider adding this to the library?
Metadata
Metadata
Assignees
Labels
No labels