SkippedTimeResolver typedef
Resolves a LocalDateTime to a ZonedDateTime in the situation where the requested local time does not exist in the target time zone.
This delegate is used by Resolvers.createMappingResolver when handling the situation where the requested local time does not exist, due to clocks moving forward in a time zone transition (usually due to a spring daylight saving transition).
The returned value will necessarily represent a different local date and time to the target one, but
the exact form of mapping is up to the delegate implementation. For example, it could return a value
as close to the target local date and time as possible, or the time immediately after the transition.
Alternatively, it can throw a SkippedTimeException
to implement a policy of "reject
skipped times."
See the Resolvers class for predefined implementations.
Implementations of this delegate can reasonably assume that the target local date and time really is skipped; the behaviour when the local date and time can be directly mapped into the target time zone is undefined.
localDateTime
: The local date and time to map to the given time zone
zone
: The target time zone
intervalBefore
: The zone interval directly before the target local date and time would have occurred
intervalAfter
: The zone interval directly after the target local date and time would have occurred
SkippedTimeException
: The implementation rejects requests to map skipped times.
Returns: A ZonedDateTime in the target time zone.
Implementation
typedef SkippedTimeResolver = ZonedDateTime Function(LocalDateTime localDateTime, DateTimeZone zone,
ZoneInterval intervalBefore, ZoneInterval intervalAfter);