@internationalized/date 3.11.0 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +113 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +45 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{CalendarDate.main.js → private/CalendarDate.cjs} +102 -120
- package/dist/private/CalendarDate.cjs.map +1 -0
- package/dist/{CalendarDate.mjs → private/CalendarDate.js} +65 -65
- package/dist/private/CalendarDate.js.map +1 -0
- package/dist/{CalendarDate.module.js → private/CalendarDate.mjs} +99 -117
- package/dist/private/CalendarDate.mjs.map +1 -0
- package/dist/{DateFormatter.main.js → private/DateFormatter.cjs} +27 -27
- package/dist/private/DateFormatter.cjs.map +1 -0
- package/dist/{DateFormatter.module.js → private/DateFormatter.js} +23 -23
- package/dist/{DateFormatter.module.js.map → private/DateFormatter.js.map} +1 -1
- package/dist/{DateFormatter.mjs → private/DateFormatter.mjs} +27 -27
- package/dist/private/DateFormatter.mjs.map +1 -0
- package/dist/{BuddhistCalendar.main.js → private/calendars/BuddhistCalendar.cjs} +13 -13
- package/dist/{BuddhistCalendar.main.js.map → private/calendars/BuddhistCalendar.cjs.map} +1 -1
- package/dist/{BuddhistCalendar.module.js → private/calendars/BuddhistCalendar.js} +13 -13
- package/dist/{BuddhistCalendar.module.js.map → private/calendars/BuddhistCalendar.js.map} +1 -1
- package/dist/{BuddhistCalendar.mjs → private/calendars/BuddhistCalendar.mjs} +13 -13
- package/dist/private/calendars/BuddhistCalendar.mjs.map +1 -0
- package/dist/{EthiopicCalendar.main.js → private/calendars/EthiopicCalendar.cjs} +32 -32
- package/dist/{EthiopicCalendar.main.js.map → private/calendars/EthiopicCalendar.cjs.map} +1 -1
- package/dist/{EthiopicCalendar.module.js → private/calendars/EthiopicCalendar.js} +30 -30
- package/dist/{EthiopicCalendar.module.js.map → private/calendars/EthiopicCalendar.js.map} +1 -1
- package/dist/{EthiopicCalendar.mjs → private/calendars/EthiopicCalendar.mjs} +30 -30
- package/dist/private/calendars/EthiopicCalendar.mjs.map +1 -0
- package/dist/{GregorianCalendar.main.js → private/calendars/GregorianCalendar.cjs} +31 -31
- package/dist/{GregorianCalendar.main.js.map → private/calendars/GregorianCalendar.cjs.map} +1 -1
- package/dist/{GregorianCalendar.module.js → private/calendars/GregorianCalendar.js} +27 -27
- package/dist/{GregorianCalendar.module.js.map → private/calendars/GregorianCalendar.js.map} +1 -1
- package/dist/{GregorianCalendar.mjs → private/calendars/GregorianCalendar.mjs} +27 -27
- package/dist/private/calendars/GregorianCalendar.mjs.map +1 -0
- package/dist/{HebrewCalendar.main.js → private/calendars/HebrewCalendar.cjs} +44 -44
- package/dist/{HebrewCalendar.main.js.map → private/calendars/HebrewCalendar.cjs.map} +1 -1
- package/dist/{HebrewCalendar.module.js → private/calendars/HebrewCalendar.js} +44 -44
- package/dist/{HebrewCalendar.module.js.map → private/calendars/HebrewCalendar.js.map} +1 -1
- package/dist/{HebrewCalendar.mjs → private/calendars/HebrewCalendar.mjs} +44 -44
- package/dist/private/calendars/HebrewCalendar.mjs.map +1 -0
- package/dist/{IndianCalendar.main.js → private/calendars/IndianCalendar.cjs} +20 -20
- package/dist/{IndianCalendar.main.js.map → private/calendars/IndianCalendar.cjs.map} +1 -1
- package/dist/{IndianCalendar.module.js → private/calendars/IndianCalendar.js} +20 -20
- package/dist/{IndianCalendar.module.js.map → private/calendars/IndianCalendar.js.map} +1 -1
- package/dist/{IndianCalendar.mjs → private/calendars/IndianCalendar.mjs} +20 -20
- package/dist/private/calendars/IndianCalendar.mjs.map +1 -0
- package/dist/private/calendars/IslamicCalendar.cjs +168 -0
- package/dist/private/calendars/IslamicCalendar.cjs.map +1 -0
- package/dist/private/calendars/IslamicCalendar.js +161 -0
- package/dist/{IslamicCalendar.module.js.map → private/calendars/IslamicCalendar.js.map} +1 -1
- package/dist/private/calendars/IslamicCalendar.mjs +161 -0
- package/dist/private/calendars/IslamicCalendar.mjs.map +1 -0
- package/dist/{JapaneseCalendar.main.js → private/calendars/JapaneseCalendar.cjs} +37 -37
- package/dist/{JapaneseCalendar.main.js.map → private/calendars/JapaneseCalendar.cjs.map} +1 -1
- package/dist/{JapaneseCalendar.module.js → private/calendars/JapaneseCalendar.js} +37 -37
- package/dist/{JapaneseCalendar.module.js.map → private/calendars/JapaneseCalendar.js.map} +1 -1
- package/dist/{JapaneseCalendar.mjs → private/calendars/JapaneseCalendar.mjs} +37 -37
- package/dist/private/calendars/JapaneseCalendar.mjs.map +1 -0
- package/dist/{PersianCalendar.main.js → private/calendars/PersianCalendar.cjs} +13 -13
- package/dist/{PersianCalendar.main.js.map → private/calendars/PersianCalendar.cjs.map} +1 -1
- package/dist/{PersianCalendar.module.js → private/calendars/PersianCalendar.js} +13 -13
- package/dist/{PersianCalendar.module.js.map → private/calendars/PersianCalendar.js.map} +1 -1
- package/dist/{PersianCalendar.mjs → private/calendars/PersianCalendar.mjs} +13 -13
- package/dist/private/calendars/PersianCalendar.mjs.map +1 -0
- package/dist/{TaiwanCalendar.main.js → private/calendars/TaiwanCalendar.cjs} +20 -20
- package/dist/{TaiwanCalendar.main.js.map → private/calendars/TaiwanCalendar.cjs.map} +1 -1
- package/dist/private/calendars/TaiwanCalendar.js +75 -0
- package/dist/{TaiwanCalendar.module.js.map → private/calendars/TaiwanCalendar.js.map} +1 -1
- package/dist/{TaiwanCalendar.mjs → private/calendars/TaiwanCalendar.mjs} +20 -20
- package/dist/private/calendars/TaiwanCalendar.mjs.map +1 -0
- package/dist/private/conversion.cjs +241 -0
- package/dist/private/conversion.cjs.map +1 -0
- package/dist/private/conversion.js +222 -0
- package/dist/private/conversion.js.map +1 -0
- package/dist/private/conversion.mjs +222 -0
- package/dist/private/conversion.mjs.map +1 -0
- package/dist/private/createCalendar.cjs +69 -0
- package/dist/{createCalendar.main.js.map → private/createCalendar.cjs.map} +1 -1
- package/dist/private/createCalendar.js +64 -0
- package/dist/{createCalendar.module.js.map → private/createCalendar.js.map} +1 -1
- package/dist/private/createCalendar.mjs +64 -0
- package/dist/private/createCalendar.mjs.map +1 -0
- package/dist/{manipulation.main.js → private/manipulation.cjs} +106 -109
- package/dist/private/manipulation.cjs.map +1 -0
- package/dist/{manipulation.mjs → private/manipulation.js} +88 -88
- package/dist/{manipulation.module.js.map → private/manipulation.js.map} +1 -1
- package/dist/{manipulation.module.js → private/manipulation.mjs} +93 -96
- package/dist/private/manipulation.mjs.map +1 -0
- package/dist/private/queries.cjs +359 -0
- package/dist/private/queries.cjs.map +1 -0
- package/dist/private/queries.js +326 -0
- package/dist/private/queries.js.map +1 -0
- package/dist/private/queries.mjs +324 -0
- package/dist/private/queries.mjs.map +1 -0
- package/dist/private/string.cjs +181 -0
- package/dist/private/string.cjs.map +1 -0
- package/dist/{string.mjs → private/string.js} +64 -64
- package/dist/{string.module.js.map → private/string.js.map} +1 -1
- package/dist/private/string.mjs +166 -0
- package/dist/private/string.mjs.map +1 -0
- package/dist/{utils.main.js → private/utils.cjs} +3 -3
- package/dist/{utils.main.js.map → private/utils.cjs.map} +1 -1
- package/dist/{utils.module.js → private/utils.js} +3 -3
- package/dist/{utils.module.js.map → private/utils.js.map} +1 -1
- package/dist/{utils.mjs → private/utils.mjs} +3 -3
- package/dist/private/utils.mjs.map +1 -0
- package/dist/{weekStartData.main.js → private/weekStartData.cjs} +3 -3
- package/dist/{weekStartData.main.js.map → private/weekStartData.cjs.map} +1 -1
- package/dist/{weekStartData.module.js → private/weekStartData.js} +3 -3
- package/dist/{weekStartData.module.js.map → private/weekStartData.js.map} +1 -1
- package/dist/{weekStartData.mjs → private/weekStartData.mjs} +3 -3
- package/dist/private/weekStartData.mjs.map +1 -0
- package/dist/types/src/CalendarDate.d.ts +177 -0
- package/dist/types/src/DateFormatter.d.ts +21 -0
- package/dist/types/src/calendars/BuddhistCalendar.d.ts +16 -0
- package/dist/types/src/calendars/EthiopicCalendar.d.ts +45 -0
- package/dist/types/src/calendars/GregorianCalendar.d.ts +25 -0
- package/dist/types/src/calendars/HebrewCalendar.d.ts +21 -0
- package/dist/types/src/calendars/IndianCalendar.d.ts +17 -0
- package/dist/types/src/calendars/IslamicCalendar.d.ts +48 -0
- package/dist/types/src/calendars/JapaneseCalendar.d.ts +21 -0
- package/dist/types/src/calendars/PersianCalendar.d.ts +19 -0
- package/dist/types/src/calendars/TaiwanCalendar.d.ts +19 -0
- package/dist/types/src/conversion.d.ts +42 -0
- package/dist/types/src/createCalendar.d.ts +3 -0
- package/dist/types/src/index.d.ts +17 -0
- package/dist/types/src/manipulation.d.ts +25 -0
- package/dist/types/src/queries.d.ts +87 -0
- package/dist/types/src/string.d.ts +35 -0
- package/dist/types/src/types.d.ts +132 -0
- package/dist/types/src/utils.d.ts +4 -0
- package/dist/types/src/weekStartData.d.ts +97 -0
- package/package.json +26 -11
- package/src/CalendarDate.ts +2 -0
- package/src/conversion.ts +10 -3
- package/src/index.ts +2 -0
- package/src/queries.ts +9 -3
- package/dist/CalendarDate.main.js.map +0 -1
- package/dist/CalendarDate.module.js.map +0 -1
- package/dist/DateFormatter.main.js.map +0 -1
- package/dist/IslamicCalendar.main.js +0 -168
- package/dist/IslamicCalendar.main.js.map +0 -1
- package/dist/IslamicCalendar.mjs +0 -161
- package/dist/IslamicCalendar.module.js +0 -161
- package/dist/TaiwanCalendar.module.js +0 -75
- package/dist/conversion.main.js +0 -236
- package/dist/conversion.main.js.map +0 -1
- package/dist/conversion.mjs +0 -218
- package/dist/conversion.module.js +0 -218
- package/dist/conversion.module.js.map +0 -1
- package/dist/createCalendar.main.js +0 -69
- package/dist/createCalendar.mjs +0 -64
- package/dist/createCalendar.module.js +0 -64
- package/dist/import.mjs +0 -45
- package/dist/main.js +0 -112
- package/dist/main.js.map +0 -1
- package/dist/manipulation.main.js.map +0 -1
- package/dist/module.js +0 -45
- package/dist/module.js.map +0 -1
- package/dist/queries.main.js +0 -354
- package/dist/queries.main.js.map +0 -1
- package/dist/queries.mjs +0 -320
- package/dist/queries.module.js +0 -320
- package/dist/queries.module.js.map +0 -1
- package/dist/string.main.js +0 -190
- package/dist/string.main.js.map +0 -1
- package/dist/string.module.js +0 -175
- package/dist/types.d.ts +0 -668
- package/dist/types.d.ts.map +0 -1
package/dist/types.d.ts
DELETED
|
@@ -1,668 +0,0 @@
|
|
|
1
|
-
type Mutable<T> = {
|
|
2
|
-
-readonly [P in keyof T]: T[P];
|
|
3
|
-
};
|
|
4
|
-
/**
|
|
5
|
-
* The Gregorian calendar is the most commonly used calendar system in the world. It supports two eras: BC, and AD.
|
|
6
|
-
* Years always contain 12 months, and 365 or 366 days depending on whether it is a leap year.
|
|
7
|
-
*/
|
|
8
|
-
export class GregorianCalendar implements Calendar {
|
|
9
|
-
identifier: CalendarIdentifier;
|
|
10
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
11
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
12
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
13
|
-
getMonthsInYear(date: AnyCalendarDate): number;
|
|
14
|
-
getDaysInYear(date: AnyCalendarDate): number;
|
|
15
|
-
getMaximumMonthsInYear(): number;
|
|
16
|
-
getMaximumDaysInMonth(): number;
|
|
17
|
-
getYearsInEra(date: AnyCalendarDate): number;
|
|
18
|
-
getEras(): string[];
|
|
19
|
-
isInverseEra(date: AnyCalendarDate): boolean;
|
|
20
|
-
balanceDate(date: Mutable<AnyCalendarDate>): void;
|
|
21
|
-
}
|
|
22
|
-
type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;
|
|
23
|
-
/** Returns whether the given dates occur on the same day, regardless of the time or calendar system. */
|
|
24
|
-
export function isSameDay(a: DateValue, b: DateValue): boolean;
|
|
25
|
-
/** Returns whether the given dates occur in the same month, using the calendar system of the first date. */
|
|
26
|
-
export function isSameMonth(a: DateValue, b: DateValue): boolean;
|
|
27
|
-
/** Returns whether the given dates occur in the same year, using the calendar system of the first date. */
|
|
28
|
-
export function isSameYear(a: DateValue, b: DateValue): boolean;
|
|
29
|
-
/** Returns whether the given dates occur on the same day, and are of the same calendar system. */
|
|
30
|
-
export function isEqualDay(a: DateValue, b: DateValue): boolean;
|
|
31
|
-
/** Returns whether the given dates occur in the same month, and are of the same calendar system. */
|
|
32
|
-
export function isEqualMonth(a: DateValue, b: DateValue): boolean;
|
|
33
|
-
/** Returns whether the given dates occur in the same year, and are of the same calendar system. */
|
|
34
|
-
export function isEqualYear(a: DateValue, b: DateValue): boolean;
|
|
35
|
-
/** Returns whether two calendars are the same. */
|
|
36
|
-
export function isEqualCalendar(a: Calendar, b: Calendar): boolean;
|
|
37
|
-
/** Returns whether the date is today in the given time zone. */
|
|
38
|
-
export function isToday(date: DateValue, timeZone: string): boolean;
|
|
39
|
-
type DayOfWeek = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
|
|
40
|
-
/**
|
|
41
|
-
* Returns the day of week for the given date and locale. Days are numbered from zero to six,
|
|
42
|
-
* where zero is the first day of the week in the given locale. For example, in the United States,
|
|
43
|
-
* the first day of the week is Sunday, but in France it is Monday.
|
|
44
|
-
*/
|
|
45
|
-
export function getDayOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number;
|
|
46
|
-
/** Returns the current time in the given time zone. */
|
|
47
|
-
export function now(timeZone: string): ZonedDateTime;
|
|
48
|
-
/** Returns today's date in the given time zone. */
|
|
49
|
-
export function today(timeZone: string): CalendarDate;
|
|
50
|
-
/**
|
|
51
|
-
* Returns the number of hours in the given date and time zone.
|
|
52
|
-
* Usually this is 24, but it could be 23 or 25 if the date is on a daylight saving transition.
|
|
53
|
-
*/
|
|
54
|
-
export function getHoursInDay(a: CalendarDate, timeZone: string): number;
|
|
55
|
-
/** Returns the time zone identifier for the current user. */
|
|
56
|
-
export function getLocalTimeZone(): string;
|
|
57
|
-
/** Sets the time zone identifier for the current user. */
|
|
58
|
-
export function setLocalTimeZone(timeZone: string): void;
|
|
59
|
-
/** Resets the time zone identifier for the current user. */
|
|
60
|
-
export function resetLocalTimeZone(): void;
|
|
61
|
-
/** Returns the first date of the month for the given date. */
|
|
62
|
-
export function startOfMonth(date: ZonedDateTime): ZonedDateTime;
|
|
63
|
-
export function startOfMonth(date: CalendarDateTime): CalendarDateTime;
|
|
64
|
-
export function startOfMonth(date: CalendarDate): CalendarDate;
|
|
65
|
-
export function startOfMonth(date: DateValue): DateValue;
|
|
66
|
-
/** Returns the last date of the month for the given date. */
|
|
67
|
-
export function endOfMonth(date: ZonedDateTime): ZonedDateTime;
|
|
68
|
-
export function endOfMonth(date: CalendarDateTime): CalendarDateTime;
|
|
69
|
-
export function endOfMonth(date: CalendarDate): CalendarDate;
|
|
70
|
-
export function endOfMonth(date: DateValue): DateValue;
|
|
71
|
-
/** Returns the first day of the year for the given date. */
|
|
72
|
-
export function startOfYear(date: ZonedDateTime): ZonedDateTime;
|
|
73
|
-
export function startOfYear(date: CalendarDateTime): CalendarDateTime;
|
|
74
|
-
export function startOfYear(date: CalendarDate): CalendarDate;
|
|
75
|
-
export function startOfYear(date: DateValue): DateValue;
|
|
76
|
-
/** Returns the last day of the year for the given date. */
|
|
77
|
-
export function endOfYear(date: ZonedDateTime): ZonedDateTime;
|
|
78
|
-
export function endOfYear(date: CalendarDateTime): CalendarDateTime;
|
|
79
|
-
export function endOfYear(date: CalendarDate): CalendarDate;
|
|
80
|
-
export function endOfYear(date: DateValue): DateValue;
|
|
81
|
-
export function getMinimumMonthInYear(date: AnyCalendarDate): number;
|
|
82
|
-
export function getMinimumDayInMonth(date: AnyCalendarDate): number;
|
|
83
|
-
/** Returns the first date of the week for the given date and locale. */
|
|
84
|
-
export function startOfWeek(date: ZonedDateTime, locale: string, firstDayOfWeek?: DayOfWeek): ZonedDateTime;
|
|
85
|
-
export function startOfWeek(date: CalendarDateTime, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDateTime;
|
|
86
|
-
export function startOfWeek(date: CalendarDate, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDate;
|
|
87
|
-
export function startOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue;
|
|
88
|
-
/** Returns the last date of the week for the given date and locale. */
|
|
89
|
-
export function endOfWeek(date: ZonedDateTime, locale: string, firstDayOfWeek?: DayOfWeek): ZonedDateTime;
|
|
90
|
-
export function endOfWeek(date: CalendarDateTime, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDateTime;
|
|
91
|
-
export function endOfWeek(date: CalendarDate, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDate;
|
|
92
|
-
export function endOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue;
|
|
93
|
-
/** Returns the number of weeks in the given month and locale. */
|
|
94
|
-
export function getWeeksInMonth(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number;
|
|
95
|
-
/** Returns the lesser of the two provider dates. */
|
|
96
|
-
export function minDate<A extends DateValue, B extends DateValue>(a?: A | null, b?: B | null): A | B | null | undefined;
|
|
97
|
-
/** Returns the greater of the two provider dates. */
|
|
98
|
-
export function maxDate<A extends DateValue, B extends DateValue>(a?: A | null, b?: B | null): A | B | null | undefined;
|
|
99
|
-
/** Returns whether the given date is on a weekend in the given locale. */
|
|
100
|
-
export function isWeekend(date: DateValue, locale: string): boolean;
|
|
101
|
-
/** Returns whether the given date is on a weekday in the given locale. */
|
|
102
|
-
export function isWeekday(date: DateValue, locale: string): boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Takes a Unix epoch (milliseconds since 1970) and converts it to the provided time zone.
|
|
105
|
-
*/
|
|
106
|
-
export function fromAbsolute(ms: number, timeZone: string): ZonedDateTime;
|
|
107
|
-
/**
|
|
108
|
-
* Takes a `Date` object and converts it to the provided time zone.
|
|
109
|
-
*/
|
|
110
|
-
export function fromDate(date: Date, timeZone: string): ZonedDateTime;
|
|
111
|
-
/** Converts a value with date components such as a `CalendarDateTime` or `ZonedDateTime` into a `CalendarDate`. */
|
|
112
|
-
export function toCalendarDate(dateTime: AnyCalendarDate): CalendarDate;
|
|
113
|
-
/**
|
|
114
|
-
* Converts a date value to a `CalendarDateTime`. An optional `Time` value can be passed to set the time
|
|
115
|
-
* of the resulting value, otherwise it will default to midnight.
|
|
116
|
-
*/
|
|
117
|
-
export function toCalendarDateTime(date: CalendarDate | CalendarDateTime | ZonedDateTime, time?: AnyTime): CalendarDateTime;
|
|
118
|
-
/** Extracts the time components from a value containing a date and time. */
|
|
119
|
-
export function toTime(dateTime: CalendarDateTime | ZonedDateTime): Time;
|
|
120
|
-
/** Converts a date from one calendar system to another. */
|
|
121
|
-
export function toCalendar<T extends AnyCalendarDate>(date: T, calendar: Calendar): T;
|
|
122
|
-
/**
|
|
123
|
-
* Converts a date value to a `ZonedDateTime` in the provided time zone. The `disambiguation` option can be set
|
|
124
|
-
* to control how values that fall on daylight saving time changes are interpreted.
|
|
125
|
-
*/
|
|
126
|
-
export function toZoned(date: CalendarDate | CalendarDateTime | ZonedDateTime, timeZone: string, disambiguation?: Disambiguation): ZonedDateTime;
|
|
127
|
-
/** Converts a `ZonedDateTime` from one time zone to another. */
|
|
128
|
-
export function toTimeZone(date: ZonedDateTime, timeZone: string): ZonedDateTime;
|
|
129
|
-
/** Converts the given `ZonedDateTime` into the user's local time zone. */
|
|
130
|
-
export function toLocalTimeZone(date: ZonedDateTime): ZonedDateTime;
|
|
131
|
-
/** Parses an ISO 8601 time string. */
|
|
132
|
-
export function parseTime(value: string): Time;
|
|
133
|
-
/** Parses an ISO 8601 date string, with no time components. */
|
|
134
|
-
export function parseDate(value: string): CalendarDate;
|
|
135
|
-
/** Parses an ISO 8601 date and time string, with no time zone. */
|
|
136
|
-
export function parseDateTime(value: string): CalendarDateTime;
|
|
137
|
-
/**
|
|
138
|
-
* Parses an ISO 8601 date and time string with a time zone extension and optional UTC offset
|
|
139
|
-
* (e.g. "2021-11-07T00:45[America/Los_Angeles]" or "2021-11-07T00:45-07:00[America/Los_Angeles]").
|
|
140
|
-
* Ambiguous times due to daylight saving time transitions are resolved according to the `disambiguation`
|
|
141
|
-
* parameter.
|
|
142
|
-
*/
|
|
143
|
-
export function parseZonedDateTime(value: string, disambiguation?: Disambiguation): ZonedDateTime;
|
|
144
|
-
/**
|
|
145
|
-
* Parses an ISO 8601 date and time string with a UTC offset (e.g. "2021-11-07T07:45:00Z"
|
|
146
|
-
* or "2021-11-07T07:45:00-07:00"). The result is converted to the provided time zone.
|
|
147
|
-
*/
|
|
148
|
-
export function parseAbsolute(value: string, timeZone: string): ZonedDateTime;
|
|
149
|
-
/**
|
|
150
|
-
* Parses an ISO 8601 date and time string with a UTC offset (e.g. "2021-11-07T07:45:00Z"
|
|
151
|
-
* or "2021-11-07T07:45:00-07:00"). The result is converted to the user's local time zone.
|
|
152
|
-
*/
|
|
153
|
-
export function parseAbsoluteToLocal(value: string): ZonedDateTime;
|
|
154
|
-
/**
|
|
155
|
-
* Parses an ISO 8601 duration string (e.g. "P3Y6M6W4DT12H30M5S").
|
|
156
|
-
* @param value An ISO 8601 duration string.
|
|
157
|
-
* @returns A DateTimeDuration object.
|
|
158
|
-
*/
|
|
159
|
-
export function parseDuration(value: string): Required<DateTimeDuration>;
|
|
160
|
-
/** A CalendarDate represents a date without any time components in a specific calendar system. */
|
|
161
|
-
export class CalendarDate {
|
|
162
|
-
#private;
|
|
163
|
-
/** The calendar system associated with this date, e.g. Gregorian. */
|
|
164
|
-
readonly calendar: Calendar;
|
|
165
|
-
/** The calendar era for this date, e.g. "BC" or "AD". */
|
|
166
|
-
readonly era: string;
|
|
167
|
-
/** The year of this date within the era. */
|
|
168
|
-
readonly year: number;
|
|
169
|
-
/**
|
|
170
|
-
* The month number within the year. Note that some calendar systems such as Hebrew
|
|
171
|
-
* may have a variable number of months per year. Therefore, month numbers may not
|
|
172
|
-
* always correspond to the same month names in different years.
|
|
173
|
-
*/
|
|
174
|
-
readonly month: number;
|
|
175
|
-
/** The day number within the month. */
|
|
176
|
-
readonly day: number;
|
|
177
|
-
constructor(year: number, month: number, day: number);
|
|
178
|
-
constructor(era: string, year: number, month: number, day: number);
|
|
179
|
-
constructor(calendar: Calendar, year: number, month: number, day: number);
|
|
180
|
-
constructor(calendar: Calendar, era: string, year: number, month: number, day: number);
|
|
181
|
-
/** Returns a copy of this date. */
|
|
182
|
-
copy(): CalendarDate;
|
|
183
|
-
/** Returns a new `CalendarDate` with the given duration added to it. */
|
|
184
|
-
add(duration: DateDuration): CalendarDate;
|
|
185
|
-
/** Returns a new `CalendarDate` with the given duration subtracted from it. */
|
|
186
|
-
subtract(duration: DateDuration): CalendarDate;
|
|
187
|
-
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
188
|
-
set(fields: DateFields): CalendarDate;
|
|
189
|
-
/**
|
|
190
|
-
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
|
|
191
|
-
* When the resulting value reaches the limits of the field, it wraps around.
|
|
192
|
-
*/
|
|
193
|
-
cycle(field: DateField, amount: number, options?: CycleOptions): CalendarDate;
|
|
194
|
-
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
|
|
195
|
-
toDate(timeZone: string): Date;
|
|
196
|
-
/** Converts the date to an ISO 8601 formatted string. */
|
|
197
|
-
toString(): string;
|
|
198
|
-
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
199
|
-
compare(b: AnyCalendarDate): number;
|
|
200
|
-
}
|
|
201
|
-
/** A Time represents a clock time without any date components. */
|
|
202
|
-
export class Time {
|
|
203
|
-
#private;
|
|
204
|
-
/** The hour, numbered from 0 to 23. */
|
|
205
|
-
readonly hour: number;
|
|
206
|
-
/** The minute in the hour. */
|
|
207
|
-
readonly minute: number;
|
|
208
|
-
/** The second in the minute. */
|
|
209
|
-
readonly second: number;
|
|
210
|
-
/** The millisecond in the second. */
|
|
211
|
-
readonly millisecond: number;
|
|
212
|
-
constructor(hour?: number, minute?: number, second?: number, millisecond?: number);
|
|
213
|
-
/** Returns a copy of this time. */
|
|
214
|
-
copy(): Time;
|
|
215
|
-
/** Returns a new `Time` with the given duration added to it. */
|
|
216
|
-
add(duration: TimeDuration): Time;
|
|
217
|
-
/** Returns a new `Time` with the given duration subtracted from it. */
|
|
218
|
-
subtract(duration: TimeDuration): Time;
|
|
219
|
-
/** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
220
|
-
set(fields: TimeFields): Time;
|
|
221
|
-
/**
|
|
222
|
-
* Returns a new `Time` with the given field adjusted by a specified amount.
|
|
223
|
-
* When the resulting value reaches the limits of the field, it wraps around.
|
|
224
|
-
*/
|
|
225
|
-
cycle(field: TimeField, amount: number, options?: CycleTimeOptions): Time;
|
|
226
|
-
/** Converts the time to an ISO 8601 formatted string. */
|
|
227
|
-
toString(): string;
|
|
228
|
-
/** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */
|
|
229
|
-
compare(b: AnyTime): number;
|
|
230
|
-
}
|
|
231
|
-
/** A CalendarDateTime represents a date and time without a time zone, in a specific calendar system. */
|
|
232
|
-
export class CalendarDateTime {
|
|
233
|
-
#private;
|
|
234
|
-
/** The calendar system associated with this date, e.g. Gregorian. */
|
|
235
|
-
readonly calendar: Calendar;
|
|
236
|
-
/** The calendar era for this date, e.g. "BC" or "AD". */
|
|
237
|
-
readonly era: string;
|
|
238
|
-
/** The year of this date within the era. */
|
|
239
|
-
readonly year: number;
|
|
240
|
-
/**
|
|
241
|
-
* The month number within the year. Note that some calendar systems such as Hebrew
|
|
242
|
-
* may have a variable number of months per year. Therefore, month numbers may not
|
|
243
|
-
* always correspond to the same month names in different years.
|
|
244
|
-
*/
|
|
245
|
-
readonly month: number;
|
|
246
|
-
/** The day number within the month. */
|
|
247
|
-
readonly day: number;
|
|
248
|
-
/** The hour in the day, numbered from 0 to 23. */
|
|
249
|
-
readonly hour: number;
|
|
250
|
-
/** The minute in the hour. */
|
|
251
|
-
readonly minute: number;
|
|
252
|
-
/** The second in the minute. */
|
|
253
|
-
readonly second: number;
|
|
254
|
-
/** The millisecond in the second. */
|
|
255
|
-
readonly millisecond: number;
|
|
256
|
-
constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);
|
|
257
|
-
constructor(era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);
|
|
258
|
-
constructor(calendar: Calendar, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);
|
|
259
|
-
constructor(calendar: Calendar, era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);
|
|
260
|
-
/** Returns a copy of this date. */
|
|
261
|
-
copy(): CalendarDateTime;
|
|
262
|
-
/** Returns a new `CalendarDateTime` with the given duration added to it. */
|
|
263
|
-
add(duration: DateTimeDuration): CalendarDateTime;
|
|
264
|
-
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
|
|
265
|
-
subtract(duration: DateTimeDuration): CalendarDateTime;
|
|
266
|
-
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
267
|
-
set(fields: DateFields & TimeFields): CalendarDateTime;
|
|
268
|
-
/**
|
|
269
|
-
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
|
|
270
|
-
* When the resulting value reaches the limits of the field, it wraps around.
|
|
271
|
-
*/
|
|
272
|
-
cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions): CalendarDateTime;
|
|
273
|
-
/** Converts the date to a native JavaScript Date object in the given time zone. */
|
|
274
|
-
toDate(timeZone: string, disambiguation?: Disambiguation): Date;
|
|
275
|
-
/** Converts the date to an ISO 8601 formatted string. */
|
|
276
|
-
toString(): string;
|
|
277
|
-
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
278
|
-
compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number;
|
|
279
|
-
}
|
|
280
|
-
/** A ZonedDateTime represents a date and time in a specific time zone and calendar system. */
|
|
281
|
-
export class ZonedDateTime {
|
|
282
|
-
#private;
|
|
283
|
-
/** The calendar system associated with this date, e.g. Gregorian. */
|
|
284
|
-
readonly calendar: Calendar;
|
|
285
|
-
/** The calendar era for this date, e.g. "BC" or "AD". */
|
|
286
|
-
readonly era: string;
|
|
287
|
-
/** The year of this date within the era. */
|
|
288
|
-
readonly year: number;
|
|
289
|
-
/**
|
|
290
|
-
* The month number within the year. Note that some calendar systems such as Hebrew
|
|
291
|
-
* may have a variable number of months per year. Therefore, month numbers may not
|
|
292
|
-
* always correspond to the same month names in different years.
|
|
293
|
-
*/
|
|
294
|
-
readonly month: number;
|
|
295
|
-
/** The day number within the month. */
|
|
296
|
-
readonly day: number;
|
|
297
|
-
/** The hour in the day, numbered from 0 to 23. */
|
|
298
|
-
readonly hour: number;
|
|
299
|
-
/** The minute in the hour. */
|
|
300
|
-
readonly minute: number;
|
|
301
|
-
/** The second in the minute. */
|
|
302
|
-
readonly second: number;
|
|
303
|
-
/** The millisecond in the second. */
|
|
304
|
-
readonly millisecond: number;
|
|
305
|
-
/** The IANA time zone identifier that this date and time is represented in. */
|
|
306
|
-
readonly timeZone: string;
|
|
307
|
-
/** The UTC offset for this time, in milliseconds. */
|
|
308
|
-
readonly offset: number;
|
|
309
|
-
constructor(year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);
|
|
310
|
-
constructor(era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);
|
|
311
|
-
constructor(calendar: Calendar, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);
|
|
312
|
-
constructor(calendar: Calendar, era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);
|
|
313
|
-
/** Returns a copy of this date. */
|
|
314
|
-
copy(): ZonedDateTime;
|
|
315
|
-
/** Returns a new `ZonedDateTime` with the given duration added to it. */
|
|
316
|
-
add(duration: DateTimeDuration): ZonedDateTime;
|
|
317
|
-
/** Returns a new `ZonedDateTime` with the given duration subtracted from it. */
|
|
318
|
-
subtract(duration: DateTimeDuration): ZonedDateTime;
|
|
319
|
-
/** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
320
|
-
set(fields: DateFields & TimeFields, disambiguation?: Disambiguation): ZonedDateTime;
|
|
321
|
-
/**
|
|
322
|
-
* Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
|
|
323
|
-
* When the resulting value reaches the limits of the field, it wraps around.
|
|
324
|
-
*/
|
|
325
|
-
cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions): ZonedDateTime;
|
|
326
|
-
/** Converts the date to a native JavaScript Date object. */
|
|
327
|
-
toDate(): Date;
|
|
328
|
-
/** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */
|
|
329
|
-
toString(): string;
|
|
330
|
-
/** Converts the date to an ISO 8601 formatted string in UTC. */
|
|
331
|
-
toAbsoluteString(): string;
|
|
332
|
-
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
333
|
-
compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number;
|
|
334
|
-
}
|
|
335
|
-
/** An interface that is compatible with any object with date fields. */
|
|
336
|
-
export interface AnyCalendarDate {
|
|
337
|
-
readonly calendar: Calendar;
|
|
338
|
-
readonly era: string;
|
|
339
|
-
readonly year: number;
|
|
340
|
-
readonly month: number;
|
|
341
|
-
readonly day: number;
|
|
342
|
-
copy(): this;
|
|
343
|
-
}
|
|
344
|
-
/** An interface that is compatible with any object with time fields. */
|
|
345
|
-
export interface AnyTime {
|
|
346
|
-
readonly hour: number;
|
|
347
|
-
readonly minute: number;
|
|
348
|
-
readonly second: number;
|
|
349
|
-
readonly millisecond: number;
|
|
350
|
-
copy(): this;
|
|
351
|
-
}
|
|
352
|
-
/** An interface that is compatible with any object with both date and time fields. */
|
|
353
|
-
export interface AnyDateTime extends AnyCalendarDate, AnyTime {
|
|
354
|
-
}
|
|
355
|
-
export type CalendarIdentifier = 'gregory' | 'buddhist' | 'chinese' | 'coptic' | 'dangi' | 'ethioaa' | 'ethiopic' | 'hebrew' | 'indian' | 'islamic' | 'islamic-umalqura' | 'islamic-tbla' | 'islamic-civil' | 'islamic-rgsa' | 'iso8601' | 'japanese' | 'persian' | 'roc';
|
|
356
|
-
/**
|
|
357
|
-
* The Calendar interface represents a calendar system, including information
|
|
358
|
-
* about how days, months, years, and eras are organized, and methods to perform
|
|
359
|
-
* arithmetic on dates.
|
|
360
|
-
*/
|
|
361
|
-
export interface Calendar {
|
|
362
|
-
/**
|
|
363
|
-
* A string identifier for the calendar, as defined by Unicode CLDR.
|
|
364
|
-
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf#supported_calendar_types).
|
|
365
|
-
*/
|
|
366
|
-
identifier: CalendarIdentifier;
|
|
367
|
-
/** Creates a CalendarDate in this calendar from the given Julian day number. */
|
|
368
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
369
|
-
/** Converts a date in this calendar to a Julian day number. */
|
|
370
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
371
|
-
/** Returns the number of days in the month of the given date. */
|
|
372
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
373
|
-
/** Returns the number of months in the year of the given date. */
|
|
374
|
-
getMonthsInYear(date: AnyCalendarDate): number;
|
|
375
|
-
/** Returns the number of years in the era of the given date. */
|
|
376
|
-
getYearsInEra(date: AnyCalendarDate): number;
|
|
377
|
-
/** Returns a list of era identifiers for the calendar. */
|
|
378
|
-
getEras(): string[];
|
|
379
|
-
/**
|
|
380
|
-
* Returns the minimum month number of the given date's year.
|
|
381
|
-
* Normally, this is 1, but in some calendars such as the Japanese,
|
|
382
|
-
* eras may begin in the middle of a year.
|
|
383
|
-
*/
|
|
384
|
-
getMinimumMonthInYear?(date: AnyCalendarDate): number;
|
|
385
|
-
/**
|
|
386
|
-
* Returns the minimum day number of the given date's month.
|
|
387
|
-
* Normally, this is 1, but in some calendars such as the Japanese,
|
|
388
|
-
* eras may begin in the middle of a month.
|
|
389
|
-
*/
|
|
390
|
-
getMinimumDayInMonth?(date: AnyCalendarDate): number;
|
|
391
|
-
/** Returns the maximum months across all years. */
|
|
392
|
-
getMaximumMonthsInYear(): number;
|
|
393
|
-
/** Returns the maximum days across all months. */
|
|
394
|
-
getMaximumDaysInMonth(): number;
|
|
395
|
-
/**
|
|
396
|
-
* Returns a date that is the first day of the month for the given date.
|
|
397
|
-
* This is used to determine the month that the given date falls in, if
|
|
398
|
-
* the calendar has months that do not align with the standard calendar months
|
|
399
|
-
* (e.g. fiscal calendars).
|
|
400
|
-
*/
|
|
401
|
-
getFormattableMonth?(date: AnyCalendarDate): CalendarDate;
|
|
402
|
-
/** Returns whether the given calendar is the same as this calendar. */
|
|
403
|
-
isEqual?(calendar: Calendar): boolean;
|
|
404
|
-
/** @private */
|
|
405
|
-
balanceDate?(date: AnyCalendarDate): void;
|
|
406
|
-
/** @private */
|
|
407
|
-
balanceYearMonth?(date: AnyCalendarDate, previousDate: AnyCalendarDate): void;
|
|
408
|
-
/** @private */
|
|
409
|
-
constrainDate?(date: AnyCalendarDate): void;
|
|
410
|
-
/** @private */
|
|
411
|
-
isInverseEra?(date: AnyCalendarDate): boolean;
|
|
412
|
-
}
|
|
413
|
-
/** Represents an amount of time in calendar-specific units, for use when performing arithmetic. */
|
|
414
|
-
export interface DateDuration {
|
|
415
|
-
/** The number of years to add or subtract. */
|
|
416
|
-
years?: number;
|
|
417
|
-
/** The number of months to add or subtract. */
|
|
418
|
-
months?: number;
|
|
419
|
-
/** The number of weeks to add or subtract. */
|
|
420
|
-
weeks?: number;
|
|
421
|
-
/** The number of days to add or subtract. */
|
|
422
|
-
days?: number;
|
|
423
|
-
}
|
|
424
|
-
/** Represents an amount of time, for use whe performing arithmetic. */
|
|
425
|
-
export interface TimeDuration {
|
|
426
|
-
/** The number of hours to add or subtract. */
|
|
427
|
-
hours?: number;
|
|
428
|
-
/** The number of minutes to add or subtract. */
|
|
429
|
-
minutes?: number;
|
|
430
|
-
/** The number of seconds to add or subtract. */
|
|
431
|
-
seconds?: number;
|
|
432
|
-
/** The number of milliseconds to add or subtract. */
|
|
433
|
-
milliseconds?: number;
|
|
434
|
-
}
|
|
435
|
-
/** Represents an amount of time with both date and time components, for use when performing arithmetic. */
|
|
436
|
-
export interface DateTimeDuration extends DateDuration, TimeDuration {
|
|
437
|
-
}
|
|
438
|
-
export interface DateFields {
|
|
439
|
-
era?: string;
|
|
440
|
-
year?: number;
|
|
441
|
-
month?: number;
|
|
442
|
-
day?: number;
|
|
443
|
-
}
|
|
444
|
-
export interface TimeFields {
|
|
445
|
-
hour?: number;
|
|
446
|
-
minute?: number;
|
|
447
|
-
second?: number;
|
|
448
|
-
millisecond?: number;
|
|
449
|
-
}
|
|
450
|
-
export type DateField = keyof DateFields;
|
|
451
|
-
export type TimeField = keyof TimeFields;
|
|
452
|
-
export type Disambiguation = 'compatible' | 'earlier' | 'later' | 'reject';
|
|
453
|
-
export interface CycleOptions {
|
|
454
|
-
/** Whether to round the field value to the nearest interval of the amount. */
|
|
455
|
-
round?: boolean;
|
|
456
|
-
}
|
|
457
|
-
export interface CycleTimeOptions extends CycleOptions {
|
|
458
|
-
/**
|
|
459
|
-
* Whether to use 12 or 24 hour time. If 12 hour time is chosen, the resulting value
|
|
460
|
-
* will remain in the same day period as the original value (e.g. if the value is AM,
|
|
461
|
-
* the resulting value also be AM).
|
|
462
|
-
* @default 24
|
|
463
|
-
*/
|
|
464
|
-
hourCycle?: 12 | 24;
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* The Japanese calendar is based on the Gregorian calendar, but with eras for the reign of each Japanese emperor.
|
|
468
|
-
* Whenever a new emperor ascends to the throne, a new era begins and the year starts again from 1.
|
|
469
|
-
* Note that eras before 1868 (Gregorian) are not currently supported by this implementation.
|
|
470
|
-
*/
|
|
471
|
-
export class JapaneseCalendar extends GregorianCalendar {
|
|
472
|
-
identifier: CalendarIdentifier;
|
|
473
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
474
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
475
|
-
balanceDate(date: Mutable<AnyCalendarDate>): void;
|
|
476
|
-
constrainDate(date: Mutable<AnyCalendarDate>): void;
|
|
477
|
-
getEras(): string[];
|
|
478
|
-
getYearsInEra(date: AnyCalendarDate): number;
|
|
479
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
480
|
-
getMinimumMonthInYear(date: AnyCalendarDate): number;
|
|
481
|
-
getMinimumDayInMonth(date: AnyCalendarDate): number;
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* The Buddhist calendar is the same as the Gregorian calendar, but counts years
|
|
485
|
-
* starting from the birth of Buddha in 543 BC (Gregorian). It supports only one
|
|
486
|
-
* era, identified as 'BE'.
|
|
487
|
-
*/
|
|
488
|
-
export class BuddhistCalendar extends GregorianCalendar {
|
|
489
|
-
identifier: CalendarIdentifier;
|
|
490
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
491
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
492
|
-
getEras(): string[];
|
|
493
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
494
|
-
balanceDate(): void;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* The Taiwanese calendar is the same as the Gregorian calendar, but years
|
|
498
|
-
* are numbered starting from 1912 (Gregorian). Two eras are supported:
|
|
499
|
-
* 'before_minguo' and 'minguo'.
|
|
500
|
-
*/
|
|
501
|
-
export class TaiwanCalendar extends GregorianCalendar {
|
|
502
|
-
identifier: CalendarIdentifier;
|
|
503
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
504
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
505
|
-
getEras(): string[];
|
|
506
|
-
balanceDate(date: Mutable<AnyCalendarDate>): void;
|
|
507
|
-
isInverseEra(date: AnyCalendarDate): boolean;
|
|
508
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
509
|
-
getYearsInEra(date: AnyCalendarDate): number;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* The Persian calendar is the main calendar used in Iran and Afghanistan. It has 12 months
|
|
513
|
-
* in each year, the first 6 of which have 31 days, and the next 5 have 30 days. The 12th month
|
|
514
|
-
* has either 29 or 30 days depending on whether it is a leap year. The Persian year starts
|
|
515
|
-
* around the March equinox.
|
|
516
|
-
*/
|
|
517
|
-
export class PersianCalendar implements Calendar {
|
|
518
|
-
identifier: CalendarIdentifier;
|
|
519
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
520
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
521
|
-
getMonthsInYear(): number;
|
|
522
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
523
|
-
getMaximumMonthsInYear(): number;
|
|
524
|
-
getMaximumDaysInMonth(): number;
|
|
525
|
-
getEras(): string[];
|
|
526
|
-
getYearsInEra(): number;
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* The Indian National Calendar is similar to the Gregorian calendar, but with
|
|
530
|
-
* years numbered since the Saka era in 78 AD (Gregorian). There are 12 months
|
|
531
|
-
* in each year, with either 30 or 31 days. Only one era identifier is supported: 'saka'.
|
|
532
|
-
*/
|
|
533
|
-
export class IndianCalendar extends GregorianCalendar {
|
|
534
|
-
identifier: CalendarIdentifier;
|
|
535
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
536
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
537
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
538
|
-
getYearsInEra(): number;
|
|
539
|
-
getEras(): string[];
|
|
540
|
-
balanceDate(): void;
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* The Islamic calendar, also known as the "Hijri" calendar, is used throughout much of the Arab world.
|
|
544
|
-
* The civil variant uses simple arithmetic rules rather than astronomical calculations to approximate
|
|
545
|
-
* the traditional calendar, which is based on sighting of the crescent moon. It uses Friday, July 16 622 CE (Julian) as the epoch.
|
|
546
|
-
* Each year has 12 months, with either 354 or 355 days depending on whether it is a leap year.
|
|
547
|
-
* Learn more about the available Islamic calendars [here](https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types).
|
|
548
|
-
*/
|
|
549
|
-
export class IslamicCivilCalendar implements Calendar {
|
|
550
|
-
identifier: CalendarIdentifier;
|
|
551
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
552
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
553
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
554
|
-
getMonthsInYear(): number;
|
|
555
|
-
getDaysInYear(date: AnyCalendarDate): number;
|
|
556
|
-
getMaximumMonthsInYear(): number;
|
|
557
|
-
getMaximumDaysInMonth(): number;
|
|
558
|
-
getYearsInEra(): number;
|
|
559
|
-
getEras(): string[];
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* The Islamic calendar, also known as the "Hijri" calendar, is used throughout much of the Arab world.
|
|
563
|
-
* The tabular variant uses simple arithmetic rules rather than astronomical calculations to approximate
|
|
564
|
-
* the traditional calendar, which is based on sighting of the crescent moon. It uses Thursday, July 15 622 CE (Julian) as the epoch.
|
|
565
|
-
* Each year has 12 months, with either 354 or 355 days depending on whether it is a leap year.
|
|
566
|
-
* Learn more about the available Islamic calendars [here](https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types).
|
|
567
|
-
*/
|
|
568
|
-
export class IslamicTabularCalendar extends IslamicCivilCalendar {
|
|
569
|
-
identifier: CalendarIdentifier;
|
|
570
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
571
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
572
|
-
}
|
|
573
|
-
/**
|
|
574
|
-
* The Islamic calendar, also known as the "Hijri" calendar, is used throughout much of the Arab world.
|
|
575
|
-
* The Umalqura variant is primarily used in Saudi Arabia. It is a lunar calendar, based on astronomical
|
|
576
|
-
* calculations that predict the sighting of a crescent moon. Month and year lengths vary between years
|
|
577
|
-
* depending on these calculations.
|
|
578
|
-
* Learn more about the available Islamic calendars [here](https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types).
|
|
579
|
-
*/
|
|
580
|
-
export class IslamicUmalquraCalendar extends IslamicCivilCalendar {
|
|
581
|
-
identifier: CalendarIdentifier;
|
|
582
|
-
constructor();
|
|
583
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
584
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
585
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
586
|
-
getDaysInYear(date: AnyCalendarDate): number;
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* The Hebrew calendar is used in Israel and around the world by the Jewish faith.
|
|
590
|
-
* Years include either 12 or 13 months depending on whether it is a leap year.
|
|
591
|
-
* In leap years, an extra month is inserted at month 6.
|
|
592
|
-
*/
|
|
593
|
-
export class HebrewCalendar implements Calendar {
|
|
594
|
-
identifier: CalendarIdentifier;
|
|
595
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
596
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
597
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
598
|
-
getMonthsInYear(date: AnyCalendarDate): number;
|
|
599
|
-
getDaysInYear(date: AnyCalendarDate): number;
|
|
600
|
-
getMaximumMonthsInYear(): number;
|
|
601
|
-
getMaximumDaysInMonth(): number;
|
|
602
|
-
getYearsInEra(): number;
|
|
603
|
-
getEras(): string[];
|
|
604
|
-
balanceYearMonth(date: Mutable<AnyCalendarDate>, previousDate: AnyCalendarDate): void;
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* The Ethiopic calendar system is the official calendar used in Ethiopia.
|
|
608
|
-
* It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending
|
|
609
|
-
* on whether it is a leap year. Two eras are supported: 'AA' and 'AM'.
|
|
610
|
-
*/
|
|
611
|
-
export class EthiopicCalendar implements Calendar {
|
|
612
|
-
identifier: CalendarIdentifier;
|
|
613
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
614
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
615
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
616
|
-
getMonthsInYear(): number;
|
|
617
|
-
getDaysInYear(date: AnyCalendarDate): number;
|
|
618
|
-
getMaximumMonthsInYear(): number;
|
|
619
|
-
getMaximumDaysInMonth(): number;
|
|
620
|
-
getYearsInEra(date: AnyCalendarDate): number;
|
|
621
|
-
getEras(): string[];
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* The Ethiopic (Amete Alem) calendar is the same as the modern Ethiopic calendar,
|
|
625
|
-
* except years were measured from a different epoch. Only one era is supported: 'AA'.
|
|
626
|
-
*/
|
|
627
|
-
export class EthiopicAmeteAlemCalendar extends EthiopicCalendar {
|
|
628
|
-
identifier: CalendarIdentifier;
|
|
629
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
630
|
-
getEras(): string[];
|
|
631
|
-
getYearsInEra(): number;
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* The Coptic calendar is similar to the Ethiopic calendar.
|
|
635
|
-
* It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending
|
|
636
|
-
* on whether it is a leap year. Two eras are supported: 'BCE' and 'CE'.
|
|
637
|
-
*/
|
|
638
|
-
export class CopticCalendar extends EthiopicCalendar {
|
|
639
|
-
identifier: CalendarIdentifier;
|
|
640
|
-
fromJulianDay(jd: number): CalendarDate;
|
|
641
|
-
toJulianDay(date: AnyCalendarDate): number;
|
|
642
|
-
getDaysInMonth(date: AnyCalendarDate): number;
|
|
643
|
-
isInverseEra(date: AnyCalendarDate): boolean;
|
|
644
|
-
balanceDate(date: Mutable<AnyCalendarDate>): void;
|
|
645
|
-
getEras(): string[];
|
|
646
|
-
getYearsInEra(date: AnyCalendarDate): number;
|
|
647
|
-
}
|
|
648
|
-
/** Creates a `Calendar` instance from a Unicode calendar identifier string. */
|
|
649
|
-
export function createCalendar(name: CalendarIdentifier): Calendar;
|
|
650
|
-
interface DateRangeFormatPart extends Intl.DateTimeFormatPart {
|
|
651
|
-
source: 'startRange' | 'endRange' | 'shared';
|
|
652
|
-
}
|
|
653
|
-
/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */
|
|
654
|
-
export class DateFormatter implements Intl.DateTimeFormat {
|
|
655
|
-
constructor(locale: string, options?: Intl.DateTimeFormatOptions);
|
|
656
|
-
/** Formats a date as a string according to the locale and format options passed to the constructor. */
|
|
657
|
-
format(value: Date): string;
|
|
658
|
-
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
|
|
659
|
-
formatToParts(value: Date): Intl.DateTimeFormatPart[];
|
|
660
|
-
/** Formats a date range as a string. */
|
|
661
|
-
formatRange(start: Date, end: Date): string;
|
|
662
|
-
/** Formats a date range as an array of parts. */
|
|
663
|
-
formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[];
|
|
664
|
-
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
665
|
-
resolvedOptions(): Intl.ResolvedDateTimeFormatOptions;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
//# sourceMappingURL=types.d.ts.map
|