ZonedDateTime constructor
ZonedDateTime([
- Instant instant = Instant.unixEpoch,
- DateTimeZone? zone,
- CalendarSystem? calendar
Initializes a new instance of ZonedDateTime in the specified time zone and the ISO or specified calendar.
instant
: The instant.zone
: The time zone.calendar
: The calendar system, defaulting to ISO.
Implementation
factory ZonedDateTime([Instant instant = Instant.unixEpoch, DateTimeZone? zone, CalendarSystem? calendar]) {
// zone = Preconditions.checkNotNull(zone, 'zone');
var _zone = zone ?? DateTimeZone.utc;
var _offsetDateTime = IOffsetDateTime.fromInstant(instant, _zone.getUtcOffset(instant), calendar);
return ZonedDateTime._(_offsetDateTime, _zone);
}