/** * @fileoverview Temporal API compatibility layer * Provides Temporal-like objects that work with native Date * When Temporal ships natively, these become thin wrappers */ /** * PlainDate - A date without time or timezone * Mirrors Temporal.PlainDate */ export interface PlainDate { readonly year: number; readonly month: number; readonly day: number; readonly dayOfWeek: number; readonly dayOfYear: number; readonly weekOfYear: number; readonly daysInMonth: number; readonly daysInYear: number; readonly monthsInYear: number; readonly inLeapYear: boolean; toString(): string; toJSON(): string; equals(other: PlainDate): boolean; compare(other: PlainDate): number; add(duration: DurationLike): PlainDate; subtract(duration: DurationLike): PlainDate; until(other: PlainDate): Duration; since(other: PlainDate): Duration; with(fields: Partial<{ year: number; month: number; day: number; }>): PlainDate; toDate(): Date; } /** * PlainTime - A time without date or timezone * Mirrors Temporal.PlainTime */ export interface PlainTime { readonly hour: number; readonly minute: number; readonly second: number; readonly millisecond: number; toString(): string; toJSON(): string; equals(other: PlainTime): boolean; compare(other: PlainTime): number; add(duration: DurationLike): PlainTime; subtract(duration: DurationLike): PlainTime; with(fields: Partial<{ hour: number; minute: number; second: number; millisecond: number; }>): PlainTime; } /** * PlainDateTime - A date and time without timezone * Mirrors Temporal.PlainDateTime */ export interface PlainDateTime { readonly year: number; readonly month: number; readonly day: number; readonly hour: number; readonly minute: number; readonly second: number; readonly millisecond: number; readonly dayOfWeek: number; readonly dayOfYear: number; readonly weekOfYear: number; toString(): string; toJSON(): string; equals(other: PlainDateTime): boolean; compare(other: PlainDateTime): number; add(duration: DurationLike): PlainDateTime; subtract(duration: DurationLike): PlainDateTime; until(other: PlainDateTime): Duration; since(other: PlainDateTime): Duration; with(fields: Partial<{ year: number; month: number; day: number; hour: number; minute: number; second: number; millisecond: number; }>): PlainDateTime; toPlainDate(): PlainDate; toPlainTime(): PlainTime; toDate(): Date; } /** * ZonedDateTime - A date and time with timezone * Mirrors Temporal.ZonedDateTime */ export interface ZonedDateTime { readonly year: number; readonly month: number; readonly day: number; readonly hour: number; readonly minute: number; readonly second: number; readonly millisecond: number; readonly timeZone: string; readonly offset: string; readonly epochMilliseconds: number; toString(): string; toJSON(): string; equals(other: ZonedDateTime): boolean; add(duration: DurationLike): ZonedDateTime; subtract(duration: DurationLike): ZonedDateTime; with(fields: Partial<{ year: number; month: number; day: number; hour: number; minute: number; second: number; millisecond: number; }>): ZonedDateTime; toPlainDate(): PlainDate; toPlainTime(): PlainTime; toPlainDateTime(): PlainDateTime; toInstant(): Instant; toDate(): Date; } /** * Instant - A point in time (like Unix timestamp) * Mirrors Temporal.Instant */ export interface Instant { readonly epochMilliseconds: number; readonly epochSeconds: number; toString(): string; toJSON(): string; equals(other: Instant): boolean; compare(other: Instant): number; add(duration: DurationLike): Instant; subtract(duration: DurationLike): Instant; until(other: Instant): Duration; since(other: Instant): Duration; toZonedDateTime(timeZone: string): ZonedDateTime; toDate(): Date; } /** * Duration - A length of time * Mirrors Temporal.Duration */ export interface Duration { readonly years: number; readonly months: number; readonly weeks: number; readonly days: number; readonly hours: number; readonly minutes: number; readonly seconds: number; readonly milliseconds: number; readonly sign: -1 | 0 | 1; readonly blank: boolean; toString(): string; toJSON(): string; negated(): Duration; abs(): Duration; add(other: DurationLike): Duration; subtract(other: DurationLike): Duration; total(unit: DurationUnit): number; } export type DurationUnit = 'years' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds'; export interface DurationLike { years?: number; months?: number; weeks?: number; days?: number; hours?: number; minutes?: number; seconds?: number; milliseconds?: number; } /** * Create a PlainDate from a Date object or components */ export declare function toPlainDate(date: Date): PlainDate; export declare function toPlainDate(year: number, month: number, day: number): PlainDate; /** * Create a PlainTime from a Date object or components */ export declare function toPlainTime(date: Date): PlainTime; export declare function toPlainTime(hour: number, minute?: number, second?: number, millisecond?: number): PlainTime; /** * Create a PlainDateTime from a Date object or components */ export declare function toPlainDateTime(date: Date): PlainDateTime; export declare function toPlainDateTime(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): PlainDateTime; /** * Create a ZonedDateTime from a Date object and timezone */ export declare function toZonedDateTime(date: Date, timeZone: string): ZonedDateTime; /** * Create an Instant from a Date object or epoch milliseconds */ export declare function toInstant(date: Date): Instant; export declare function toInstant(epochMs: number): Instant; /** * Create a Duration from components */ export declare function createDuration(fields?: DurationLike): Duration; /** * Parse an ISO 8601 duration string */ export declare function parseDuration(str: string): Duration; /** * Get current instant */ export declare function nowInstant(): Instant; /** * Get current PlainDateTime in local timezone */ export declare function nowPlainDateTime(): PlainDateTime; /** * Get current PlainDate in local timezone */ export declare function nowPlainDate(): PlainDate; /** * Get current PlainTime in local timezone */ export declare function nowPlainTime(): PlainTime; /** * Get current ZonedDateTime in specified timezone */ export declare function nowZonedDateTime(timeZone: string): ZonedDateTime; /** * Convert Temporal-like object back to Date */ export declare function fromTemporal(temporal: PlainDate | PlainDateTime | ZonedDateTime | Instant): Date; //# sourceMappingURL=temporal.d.ts.map