ZonedDateTime.atLeniently constructor

ZonedDateTime.atLeniently(
  1. LocalDateTime localDateTime,
  2. DateTimeZone zone
)

Maps the given LocalDateTime to the corresponding ZonedDateTime in a lenient manner: ambiguous values map to the earlier of the alternatives, and 'skipped' values are shifted forward by the duration of the 'gap'.

See atStrictly and ResolveLocal(LocalDateTime, ZoneLocalMappingResolver) for alternative ways to map a local time to a specific instant.

Note: The behavior of this method was changed in version 2.0 to fit the most commonly seen real-world usage pattern. Previous versions returned the later instance of ambiguous values, and returned the start of the zone interval after the gap for skipped value. The previous functionality can still be used if desired, by using ResolveLocal(LocalDateTime, ZoneLocalMappingResolver), passing in a resolver created from Resolvers.returnLater and Resolvers.returnStartOfIntervalAfter.

  • localDateTime: The local date/time to map.

The unambiguous mapping if there is one, the earlier result if the mapping is ambiguous, or the forward-shifted value if the given local date/time is skipped.

Implementation

factory ZonedDateTime.atLeniently(LocalDateTime localDateTime, DateTimeZone zone) =>
    ZonedDateTime.resolve(localDateTime, zone, Resolvers.lenientResolver);