blob: 38e69d477c3742cdd8c3b993edc834f4a66e8169 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Minimal ambient Temporal declarations (no polyfill); extend as needed.
declare global {
namespace Temporal {
type TimeZoneId = string;
type DurationLike = {
days?: number;
hours?: number;
milliseconds?: number;
};
interface Duration {
readonly days: number;
total(options: { unit: 'millisecond' | 'day' }): number;
}
namespace Duration {
function from(durationLike: DurationLike): Duration;
}
interface Instant {
readonly epochMilliseconds: number;
add(durationLike: { hours?: number; milliseconds?: number }): Instant;
toString(options?: { smallestUnit?: 'millisecond' }): string;
toZonedDateTimeISO(timeZone: TimeZoneId): ZonedDateTime;
toLocaleString(
locales?: string | string[],
options?: Intl.DateTimeFormatOptions,
): string;
}
namespace Instant {
function compare(a: string | Instant, b: string | Instant): number;
function from(iso: string): Instant;
function fromEpochMilliseconds(ms: number): Instant;
}
interface ZonedDateTime {
add(durationLike: DurationLike): ZonedDateTime;
startOfDay(): ZonedDateTime;
toInstant(): Instant;
toPlainDate(): PlainDate;
toLocaleString(
locales?: string | string[],
options?: Intl.DateTimeFormatOptions,
): string;
}
interface PlainDate {
/** ISO day of week: Monday = 1 … Sunday = 7. */
readonly dayOfWeek: number;
add(durationLike: DurationLike): PlainDate;
subtract(durationLike: DurationLike): PlainDate;
/** Difference to another date; largest unit defaults to days. */
until(other: PlainDate): Duration;
toZonedDateTime(timeZone: TimeZoneId): ZonedDateTime;
toString(): string;
}
namespace PlainDate {
function from(
plainDateLike: { year: number; month: number; day: number } | string,
): PlainDate;
}
namespace Now {
function instant(): Instant;
function timeZoneId(): TimeZoneId;
}
}
}
export {};
|