# ZonedDateTime

`import { ZonedDateTime } from "destack:time";`

Temporal zoned date-time.

```ds title="ZonedDateTime"
export class ZonedDateTime {
    static from(item: ZonedDateTime | ZonedDateTimeLike | string, options?: ZonedDateTimeAssignmentOptions | undefined): ZonedDateTime;
    static compare(one: ZonedDateTime | ZonedDateTimeLike | string, two: ZonedDateTime | ZonedDateTimeLike | string): -1 | 0 | 1;
    constructor(epochNanoseconds: bigint, timeZone: string, calendar?: string | undefined);
    get era(): MaybeOwned<string> | undefined;
    get eraYear(): float64 | undefined;
    get year(): float64;
    get month(): float64;
    get monthCode(): Cow<"frame", string>;
    get day(): float64;
    get hour(): float64;
    get minute(): float64;
    get second(): float64;
    get millisecond(): float64;
    get microsecond(): float64;
    get nanosecond(): float64;
    get timeZoneId(): Cow<"frame", string>;
    get calendarId(): Cow<"frame", string>;
    get dayOfWeek(): float64;
    get dayOfYear(): float64;
    get weekOfYear(): float64 | undefined;
    get yearOfWeek(): float64 | undefined;
    get hoursInDay(): float64;
    get daysInWeek(): float64;
    get daysInMonth(): float64;
    get daysInYear(): float64;
    get monthsInYear(): float64;
    get inLeapYear(): boolean;
    get offsetNanoseconds(): float64;
    get offset(): Cow<"frame", string>;
    get epochMilliseconds(): float64;
    get epochNanoseconds(): bigint;
    equals(other: ZonedDateTime | ZonedDateTimeLike | string): boolean;
    with(zonedDateTimeLike: PlainDateTimeLike & { offset?: string; timeZone?: TimeZoneLike; calendar?: CalendarLike }, options?: ZonedDateTimeAssignmentOptions | undefined): ZonedDateTime;
    withPlainTime(time?: PlainTime | PlainTimeLike | string | undefined): ZonedDateTime;
    withCalendar(calendar: string | ZonedDateTime | PlainDateTime | PlainDate | PlainYearMonth | PlainMonthDay): ZonedDateTime;
    withTimeZone(timeZone: string | ZonedDateTime): ZonedDateTime;
    add(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): ZonedDateTime;
    subtract(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): ZonedDateTime;
    until(other: ZonedDateTime | ZonedDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): Duration;
    since(other: ZonedDateTime | ZonedDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): Duration;
    round(roundTo: SmallestUnit<"day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | { smallestUnit: SmallestUnit<"day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond">; roundingIncrement?: float64; roundingMode?: RoundingMode }): ZonedDateTime;
    startOfDay(): ZonedDateTime;
    getTimeZoneTransition(direction: "next" | "previous" | { direction: "next" | "previous" }): ZonedDateTime | null;
    toInstant(): Instant;
    toPlainDateTime(): PlainDateTime;
    toPlainDate(): PlainDate;
    toPlainTime(): PlainTime;
    toLocaleString(locales?: LocalesArgument | undefined, options?: DateTimeFormatOptions | undefined): Cow<"frame", string>;
    toJSON(): Cow<"frame", string>;
    toString(options?: ZonedDateTimeToStringOptions | undefined): Cow<"frame", string>;
    valueOf(): never;
}
```

[language/library/src/time/zoned-date-time.ds:42:344](https://github.com/destack-sh/destack/blob/main/language/library/src/time/zoned-date-time.ds#L42-L344)

## Members

### `static from(item: ZonedDateTime | ZonedDateTimeLike | string, options?: ZonedDateTimeAssignmentOptions | undefined): ZonedDateTime`

Create a zoned date-time.

### `static compare(one: ZonedDateTime | ZonedDateTimeLike | string, two: ZonedDateTime | ZonedDateTimeLike | string): -1 | 0 | 1`

Compare two zoned date-times.

### `constructor(epochNanoseconds: bigint, timeZone: string, calendar?: string | undefined)`

Create a zoned date-time.

### `get era(): MaybeOwned<string> | undefined`

Calendar era.

### `get eraYear(): float64 | undefined`

Calendar era year.

### `get year(): float64`

Calendar year.

### `get month(): float64`

Calendar month.

### `get monthCode(): Cow<"frame", string>`

Calendar month code.

### `get day(): float64`

Calendar day.

### `get hour(): float64`

Hour.

### `get minute(): float64`

Minute.

### `get second(): float64`

Second.

### `get millisecond(): float64`

Millisecond.

### `get microsecond(): float64`

Microsecond.

### `get nanosecond(): float64`

Nanosecond.

### `get timeZoneId(): Cow<"frame", string>`

Time-zone identifier.

### `get calendarId(): Cow<"frame", string>`

Calendar identifier.

### `get dayOfWeek(): float64`

Day of week.

### `get dayOfYear(): float64`

Day of year.

### `get weekOfYear(): float64 | undefined`

Week of year.

### `get yearOfWeek(): float64 | undefined`

Week-based year.

### `get hoursInDay(): float64`

Hours in this day.

### `get daysInWeek(): float64`

Days in this week.

### `get daysInMonth(): float64`

Days in this month.

### `get daysInYear(): float64`

Days in this year.

### `get monthsInYear(): float64`

Months in this year.

### `get inLeapYear(): boolean`

Whether this year is a leap year.

### `get offsetNanoseconds(): float64`

Offset in nanoseconds.

### `get offset(): Cow<"frame", string>`

Offset string.

### `get epochMilliseconds(): float64`

Epoch milliseconds.

### `get epochNanoseconds(): bigint`

Epoch nanoseconds.

### `equals(other: ZonedDateTime | ZonedDateTimeLike | string): boolean`

Return true when this zoned date-time equals `other`.

### `with(zonedDateTimeLike: PlainDateTimeLike & { offset?: string; timeZone?: TimeZoneLike; calendar?: CalendarLike }, options?: ZonedDateTimeAssignmentOptions | undefined): ZonedDateTime`

Return this zoned date-time with updated fields.

### `withPlainTime(time?: PlainTime | PlainTimeLike | string | undefined): ZonedDateTime`

Return this zoned date-time with another time.

### `withCalendar(calendar: string | ZonedDateTime | PlainDateTime | PlainDate | PlainYearMonth | PlainMonthDay): ZonedDateTime`

Return this zoned date-time in another calendar.

### `withTimeZone(timeZone: string | ZonedDateTime): ZonedDateTime`

Return this zoned date-time in another time zone.

### `add(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): ZonedDateTime`

Add a duration.

### `subtract(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): ZonedDateTime`

Subtract a duration.

### `until(other: ZonedDateTime | ZonedDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): Duration`

Return the duration until `other`.

### `since(other: ZonedDateTime | ZonedDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): Duration`

Return the duration since `other`.

### `round(roundTo: SmallestUnit<"day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | { smallestUnit: SmallestUnit<"day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond">; roundingIncrement?: float64; roundingMode?: RoundingMode }): ZonedDateTime`

Round this zoned date-time.

### `startOfDay(): ZonedDateTime`

Return the start of this day.

### `getTimeZoneTransition(direction: "next" | "previous" | { direction: "next" | "previous" }): ZonedDateTime | null`

Return the next or previous time-zone transition.

### `toInstant(): Instant`

Convert this zoned date-time into an instant.

### `toPlainDateTime(): PlainDateTime`

Return the plain date-time part.

### `toPlainDate(): PlainDate`

Return the plain date part.

### `toPlainTime(): PlainTime`

Return the plain time part.

### `toLocaleString(locales?: LocalesArgument | undefined, options?: DateTimeFormatOptions | undefined): Cow<"frame", string>`

Return a locale-aware string.

### `toJSON(): Cow<"frame", string>`

Return a JSON string.

### `toString(options?: ZonedDateTimeToStringOptions | undefined): Cow<"frame", string>`

Return an ISO string.

### `valueOf(): never`

Reject numeric coercion.
