menu
ZonedDateTime
import { ZonedDateTime } from "destack:time";
Temporal zoned date-time.
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): ZonedDateTimeCreate a zoned date-time.
static compare(one: ZonedDateTime | ZonedDateTimeLike | string, two: ZonedDateTime | ZonedDateTimeLike | string): -1 | 0 | 1Compare two zoned date-times.
constructor(epochNanoseconds: bigint, timeZone: string, calendar?: string | undefined)Create a zoned date-time.
get era(): MaybeOwned<string> | undefinedCalendar era.
get eraYear(): float64 | undefinedCalendar era year.
get year(): float64Calendar year.
get month(): float64Calendar month.
get monthCode(): Cow<"frame", string>Calendar month code.
get day(): float64Calendar day.
get hour(): float64Hour.
get minute(): float64Minute.
get second(): float64Second.
get millisecond(): float64Millisecond.
get microsecond(): float64Microsecond.
get nanosecond(): float64Nanosecond.
get timeZoneId(): Cow<"frame", string>Time-zone identifier.
get calendarId(): Cow<"frame", string>Calendar identifier.
get dayOfWeek(): float64Day of week.
get dayOfYear(): float64Day of year.
get weekOfYear(): float64 | undefinedWeek of year.
get yearOfWeek(): float64 | undefinedWeek-based year.
get hoursInDay(): float64Hours in this day.
get daysInWeek(): float64Days in this week.
get daysInMonth(): float64Days in this month.
get daysInYear(): float64Days in this year.
get monthsInYear(): float64Months in this year.
get inLeapYear(): booleanWhether this year is a leap year.
get offsetNanoseconds(): float64Offset in nanoseconds.
get offset(): Cow<"frame", string>Offset string.
get epochMilliseconds(): float64Epoch milliseconds.
get epochNanoseconds(): bigintEpoch nanoseconds.
equals(other: ZonedDateTime | ZonedDateTimeLike | string): booleanReturn true when this zoned date-time equals
other.with(zonedDateTimeLike: PlainDateTimeLike & { offset?: string; timeZone?: TimeZoneLike; calendar?: CalendarLike }, options?: ZonedDateTimeAssignmentOptions | undefined): ZonedDateTimeReturn this zoned date-time with updated fields.
withPlainTime(time?: PlainTime | PlainTimeLike | string | undefined): ZonedDateTimeReturn this zoned date-time with another time.
withCalendar(calendar: string | ZonedDateTime | PlainDateTime | PlainDate | PlainYearMonth | PlainMonthDay): ZonedDateTimeReturn this zoned date-time in another calendar.
withTimeZone(timeZone: string | ZonedDateTime): ZonedDateTimeReturn this zoned date-time in another time zone.
add(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): ZonedDateTimeAdd a duration.
subtract(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): ZonedDateTimeSubtract a duration.
until(other: ZonedDateTime | ZonedDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): DurationReturn the duration until
other.since(other: ZonedDateTime | ZonedDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): DurationReturn 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 }): ZonedDateTimeRound this zoned date-time.
startOfDay(): ZonedDateTimeReturn the start of this day.
getTimeZoneTransition(direction: "next" | "previous" | { direction: "next" | "previous" }): ZonedDateTime | nullReturn the next or previous time-zone transition.
toInstant(): InstantConvert this zoned date-time into an instant.
toPlainDateTime(): PlainDateTimeReturn the plain date-time part.
toPlainDate(): PlainDateReturn the plain date part.
toPlainTime(): PlainTimeReturn 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(): neverReject numeric coercion.