AmbiguousTimeError constructor

AmbiguousTimeError(
  1. ZonedDateTime earlierMapping,
  2. ZonedDateTime laterMapping
)

Constructs an instance from the given information.

User code is unlikely to need to deliberately call this constructor except possibly for testing.

The two mappings must have the same local time and time zone.

Implementation

AmbiguousTimeError(this.earlierMapping, this.laterMapping)
    : message = 'Local time ${earlierMapping.localDateTime} is ambiguous in time zone ${earlierMapping.zone.id}' {
  Preconditions.checkArgument(earlierMapping.zone == laterMapping.zone, 'laterMapping',
      'Ambiguous possible values must use the same time zone');
  Preconditions.checkArgument(earlierMapping.localDateTime == laterMapping.localDateTime, 'laterMapping',
      'Ambiguous possible values must have the same local date/time');
}