menu

ZonedDateTime

import { ZonedDateTime } from "destack:time";

Temporal zoned date-time.

language/library/src/time/zoned-date-time.ds:42:344
1export class ZonedDateTime {2    static from(item: ZonedDateTime | ZonedDateTimeLike | string, options?: ZonedDateTimeAssignmentOptions | undefined): ZonedDateTime;3    static compare(one: ZonedDateTime | ZonedDateTimeLike | string, two: ZonedDateTime | ZonedDateTimeLike | string): -1 | 0 | 1;4    constructor(epochNanoseconds: bigint, timeZone: string, calendar?: string | undefined);5    get era(): MaybeOwned<string> | undefined;6    get eraYear(): float64 | undefined;7    get year(): float64;8    get month(): float64;9    get monthCode(): Cow<"frame", string>;10    get day(): float64;11    get hour(): float64;12    get minute(): float64;13    get second(): float64;14    get millisecond(): float64;15    get microsecond(): float64;16    get nanosecond(): float64;17    get timeZoneId(): Cow<"frame", string>;18    get calendarId(): Cow<"frame", string>;19    get dayOfWeek(): float64;20    get dayOfYear(): float64;21    get weekOfYear(): float64 | undefined;22    get yearOfWeek(): float64 | undefined;23    get hoursInDay(): float64;24    get daysInWeek(): float64;25    get daysInMonth(): float64;26    get daysInYear(): float64;27    get monthsInYear(): float64;28    get inLeapYear(): boolean;29    get offsetNanoseconds(): float64;30    get offset(): Cow<"frame", string>;31    get epochMilliseconds(): float64;32    get epochNanoseconds(): bigint;33    equals(other: ZonedDateTime | ZonedDateTimeLike | string): boolean;34    with(zonedDateTimeLike: PlainDateTimeLike & { offset?: string; timeZone?: TimeZoneLike; calendar?: CalendarLike }, options?: ZonedDateTimeAssignmentOptions | undefined): ZonedDateTime;35    withPlainTime(time?: PlainTime | PlainTimeLike | string | undefined): ZonedDateTime;36    withCalendar(calendar: string | ZonedDateTime | PlainDateTime | PlainDate | PlainYearMonth | PlainMonthDay): ZonedDateTime;37    withTimeZone(timeZone: string | ZonedDateTime): ZonedDateTime;38    add(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): ZonedDateTime;39    subtract(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): ZonedDateTime;40    until(other: ZonedDateTime | ZonedDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): Duration;41    since(other: ZonedDateTime | ZonedDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): Duration;42    round(roundTo: SmallestUnit<"day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | { smallestUnit: SmallestUnit<"day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond">; roundingIncrement?: float64; roundingMode?: RoundingMode }): ZonedDateTime;43    startOfDay(): ZonedDateTime;44    getTimeZoneTransition(direction: "next" | "previous" | { direction: "next" | "previous" }): ZonedDateTime | null;45    toInstant(): Instant;46    toPlainDateTime(): PlainDateTime;47    toPlainDate(): PlainDate;48    toPlainTime(): PlainTime;49    toLocaleString(locales?: LocalesArgument | undefined, options?: DateTimeFormatOptions | undefined): Cow<"frame", string>;50    toJSON(): Cow<"frame", string>;51    toString(options?: ZonedDateTimeToStringOptions | undefined): Cow<"frame", string>;52    valueOf(): never;53}

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.