@day-kit/date-engine 0.0.0-stage → 1.0.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.
@@ -0,0 +1,235 @@
1
+ /**
2
+ * Calendar system identifiers known to the library (CLDR / Temporal identifiers).
3
+ *
4
+ * Whether a given identifier is usable depends on the configured date engine.
5
+ * Use `engine.getSupportedCalendarSystems()` for the actual capabilities.
6
+ */
7
+ type CalendarSystem = "iso8601" | "gregory" | "buddhist" | "chinese" | "coptic" | "dangi" | "ethiopic" | "ethioaa" | "hebrew" | "indian" | "islamic-civil" | "islamic-tbla" | "islamic-umalqura" | "japanese" | "persian" | "roc";
8
+ declare const knownCalendarSystems: readonly CalendarSystem[];
9
+ declare function isKnownCalendarSystem(value: string): value is CalendarSystem;
10
+ declare const instantBrand: unique symbol;
11
+ /**
12
+ * An absolute point in time as epoch milliseconds.
13
+ * Instants are plain numbers at runtime: comparison and elapsed arithmetic are exact.
14
+ */
15
+ type Instant = number & {
16
+ readonly [instantBrand]: "Instant";
17
+ };
18
+ declare const calendarDateBrand: unique symbol;
19
+ /**
20
+ * A date in a specific calendar system, without time or time zone.
21
+ * Opaque: only the engine that created it can read or transform it.
22
+ */
23
+ interface CalendarDate {
24
+ readonly [calendarDateBrand]: "CalendarDate";
25
+ }
26
+ declare const localDateTimeBrand: unique symbol;
27
+ /**
28
+ * A wall-clock date and time in a specific calendar system, without a time zone.
29
+ * Opaque: only the engine that created it can read or transform it.
30
+ */
31
+ interface LocalDateTime {
32
+ readonly [localDateTimeBrand]: "LocalDateTime";
33
+ }
34
+ /** Day of week: 0 = Sunday … 6 = Saturday (same as `Date#getDay`). */
35
+ type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
36
+ /** How out-of-range calendar fields are handled. */
37
+ type Overflow = "constrain" | "reject";
38
+ /** How a wall-clock time is mapped to an instant around time-zone transitions. */
39
+ type Disambiguation = "compatible" | "earlier" | "later" | "reject";
40
+ /** A calendar (not elapsed) duration. */
41
+ interface CalendarDuration {
42
+ readonly years?: number;
43
+ readonly months?: number;
44
+ readonly weeks?: number;
45
+ readonly days?: number;
46
+ }
47
+ type CalendarPeriodUnit = "day" | "week" | "month" | "year";
48
+ /** A half-open calendar period `[start, end)`. */
49
+ interface CalendarPeriod {
50
+ readonly unit: CalendarPeriodUnit;
51
+ readonly start: CalendarDate;
52
+ readonly end: CalendarDate;
53
+ }
54
+ /** Calendar-specific metadata of a date. */
55
+ interface CalendarDateFields {
56
+ readonly calendarSystem: CalendarSystem;
57
+ readonly year: number;
58
+ /** Ordinal month within the year, starting at 1. Its meaning depends on the year (leap months). */
59
+ readonly month: number;
60
+ /** Stable month identity within a calendar, e.g. `M05L` for Hebrew Adar I. */
61
+ readonly monthCode: string;
62
+ readonly day: number;
63
+ readonly dayOfWeek: Weekday;
64
+ readonly dayOfYear: number;
65
+ readonly daysInWeek: number;
66
+ readonly daysInMonth: number;
67
+ readonly daysInYear: number;
68
+ readonly monthsInYear: number;
69
+ readonly inLeapYear: boolean;
70
+ readonly era?: string;
71
+ readonly eraYear?: number;
72
+ /** Calendar-specific week number. Undefined when the calendar defines none. */
73
+ readonly weekOfYear?: number;
74
+ readonly yearOfWeek?: number;
75
+ }
76
+ /** Fields accepted when constructing a calendar date. Validated by the engine. */
77
+ interface CalendarDateInput {
78
+ readonly year?: number;
79
+ readonly era?: string;
80
+ readonly eraYear?: number;
81
+ readonly month?: number;
82
+ readonly monthCode?: string;
83
+ readonly day: number;
84
+ }
85
+ /** Changes applied to an existing calendar date. */
86
+ interface CalendarDateChange {
87
+ readonly year?: number;
88
+ readonly month?: number;
89
+ readonly monthCode?: string;
90
+ readonly day?: number;
91
+ }
92
+ /** Proleptic ISO-8601 (Gregorian) date fields. */
93
+ interface IsoDateFields {
94
+ readonly year: number;
95
+ readonly month: number;
96
+ readonly day: number;
97
+ }
98
+ interface WallClockTime {
99
+ readonly hour: number;
100
+ readonly minute: number;
101
+ readonly second: number;
102
+ readonly millisecond: number;
103
+ }
104
+ /** The calendar date and wall-clock time of an instant in a time zone. */
105
+ interface ZonedDateTimeFields {
106
+ readonly date: CalendarDate;
107
+ readonly time: WallClockTime;
108
+ readonly offsetMilliseconds: number;
109
+ }
110
+ /** The first instant of a civil day in a time zone. */
111
+ interface DayStart {
112
+ readonly instant: Instant;
113
+ /**
114
+ * True when the civil day does not exist in the time zone (e.g. 2011-12-30 in Pacific/Apia).
115
+ * `instant` is then the start of the next existing day.
116
+ */
117
+ readonly isSkipped: boolean;
118
+ }
119
+ /** How a wall-clock time maps onto instants in a time zone. */
120
+ type LocalTimeResolution = {
121
+ readonly kind: "unique";
122
+ readonly instant: Instant;
123
+ } | {
124
+ readonly kind: "repeated";
125
+ readonly earlier: Instant;
126
+ readonly later: Instant;
127
+ } | {
128
+ readonly kind: "nonexistent";
129
+ readonly earlier: Instant;
130
+ readonly later: Instant;
131
+ };
132
+ /** A half-open instant interval `[start, end)`. */
133
+ interface InstantInterval {
134
+ readonly start: Instant;
135
+ readonly end: Instant;
136
+ }
137
+ /** Intl options that describe a calendar date (no time, no time zone). */
138
+ type CalendarDateFormatOptions = Pick<Intl.DateTimeFormatOptions, "era" | "year" | "month" | "day" | "weekday" | "dateStyle" | "numberingSystem">;
139
+ /** Intl options for formatting an instant; calendar and time zone are configured separately. */
140
+ type InstantFormatOptions = Omit<Intl.DateTimeFormatOptions, "calendar" | "timeZone">;
141
+ interface CalendarDateFormatterOptions {
142
+ readonly locale?: string;
143
+ readonly calendarSystem: CalendarSystem;
144
+ readonly format: CalendarDateFormatOptions;
145
+ }
146
+ interface InstantFormatterOptions {
147
+ readonly locale?: string;
148
+ readonly calendarSystem: CalendarSystem;
149
+ readonly timeZone: string;
150
+ readonly format: InstantFormatOptions;
151
+ }
152
+ interface ResolvedFormatInfo {
153
+ readonly locale: string;
154
+ readonly calendarSystem: CalendarSystem;
155
+ readonly numberingSystem: string;
156
+ }
157
+ /** Formats calendar dates independently of any time zone. */
158
+ interface CalendarDateFormatter {
159
+ readonly resolved: ResolvedFormatInfo;
160
+ readonly format: (date: CalendarDate) => string;
161
+ readonly formatToParts: (date: CalendarDate) => Intl.DateTimeFormatPart[];
162
+ /** Formats an inclusive range of calendar dates, e.g. "Mar 10 – 16, 2024". */
163
+ readonly formatRange: (start: CalendarDate, end: CalendarDate) => string;
164
+ }
165
+ /** Formats instants in a configured calendar system and time zone. */
166
+ interface InstantFormatter {
167
+ readonly resolved: ResolvedFormatInfo;
168
+ readonly format: (instant: Instant) => string;
169
+ readonly formatToParts: (instant: Instant) => Intl.DateTimeFormatPart[];
170
+ readonly formatRange: (start: Instant, end: Instant) => string;
171
+ }
172
+ interface IsoWeek {
173
+ readonly week: number;
174
+ readonly year: number;
175
+ }
176
+ /**
177
+ * The calendar arithmetic contract used by `@day-kit/core`.
178
+ *
179
+ * Every operation is pure. `CalendarDate` and `LocalDateTime` handles are opaque and
180
+ * must only be passed back to the engine that created them.
181
+ * Methods throw `CalendarError` subclasses; they never fall back to Gregorian arithmetic.
182
+ */
183
+ interface DateEngine {
184
+ /** Implementation identifier, e.g. `temporal-polyfill/full`. */
185
+ readonly name: string;
186
+ readonly getSupportedCalendarSystems: () => readonly CalendarSystem[];
187
+ readonly isCalendarSystemSupported: (calendarSystem: string) => calendarSystem is CalendarSystem;
188
+ /** Returns the calendar system or throws `CalendarSystemNotSupportedError`. */
189
+ readonly requireCalendarSystem: (calendarSystem: string) => CalendarSystem;
190
+ /** Whether the runtime can format this calendar with Intl consistently with the engine. */
191
+ readonly isFormattingSupported: (calendarSystem: CalendarSystem) => boolean;
192
+ /** Returns the canonical IANA identifier or throws `InvalidTimeZoneError`. */
193
+ readonly canonicalizeTimeZone: (timeZone: string) => string;
194
+ /** The current instant from the host clock. Core prefers its injectable clock. */
195
+ readonly now: () => Instant;
196
+ /** The civil date that contains `instant` in `timeZone`. */
197
+ readonly toCalendarDate: (instant: Instant, timeZone: string, calendarSystem: CalendarSystem) => CalendarDate;
198
+ /** The first instant of the civil day, with skipped-day detection. */
199
+ readonly getDayStart: (date: CalendarDate, timeZone: string) => DayStart;
200
+ /** The calendar date and wall-clock time of an instant. */
201
+ readonly toZonedFields: (instant: Instant, timeZone: string, calendarSystem: CalendarSystem) => ZonedDateTimeFields;
202
+ readonly getOffsetMilliseconds: (instant: Instant, timeZone: string) => number;
203
+ readonly createDate: (input: CalendarDateInput, calendarSystem: CalendarSystem, overflow?: Overflow) => CalendarDate;
204
+ readonly fromIsoDate: (iso: IsoDateFields, calendarSystem: CalendarSystem) => CalendarDate;
205
+ readonly toIsoDate: (date: CalendarDate) => IsoDateFields;
206
+ readonly withCalendar: (date: CalendarDate, calendarSystem: CalendarSystem) => CalendarDate;
207
+ readonly getCalendarSystem: (date: CalendarDate) => CalendarSystem;
208
+ /** Stable identity key including the calendar, e.g. `hebrew:2024-03-01` (ISO date). */
209
+ readonly toKey: (date: CalendarDate) => string;
210
+ readonly getDateFields: (date: CalendarDate) => CalendarDateFields;
211
+ /** ISO-8601 week (computed on the ISO calendar), explicitly ISO. */
212
+ readonly getIsoWeek: (date: CalendarDate) => IsoWeek;
213
+ readonly add: (date: CalendarDate, duration: CalendarDuration, overflow?: Overflow) => CalendarDate;
214
+ readonly with: (date: CalendarDate, change: CalendarDateChange, overflow?: Overflow) => CalendarDate;
215
+ /** Whole units from `from` to `to` (negative when `to` is earlier). Both must share a calendar for months/years. */
216
+ readonly until: (from: CalendarDate, to: CalendarDate, unit: "days" | "months" | "years") => number;
217
+ readonly compare: (a: CalendarDate, b: CalendarDate) => -1 | 0 | 1;
218
+ readonly equals: (a: CalendarDate, b: CalendarDate) => boolean;
219
+ readonly startOfWeek: (date: CalendarDate, weekStartsOn: Weekday) => CalendarDate;
220
+ readonly startOfMonth: (date: CalendarDate) => CalendarDate;
221
+ readonly startOfYear: (date: CalendarDate) => CalendarDate;
222
+ readonly getPeriod: (date: CalendarDate, unit: "day" | "month" | "year") => CalendarPeriod;
223
+ readonly getWeekPeriod: (date: CalendarDate, weekStartsOn: Weekday) => CalendarPeriod;
224
+ /** First day of every month of the date's calendar year, traversing real month boundaries. */
225
+ readonly getMonthsOfYear: (date: CalendarDate) => readonly CalendarDate[];
226
+ readonly createLocalDateTime: (date: CalendarDate, time: Partial<WallClockTime>) => LocalDateTime;
227
+ readonly resolveLocalDateTime: (local: LocalDateTime, timeZone: string) => LocalTimeResolution;
228
+ /** Resolves a wall-clock time; `reject` throws on nonexistent or repeated times. */
229
+ readonly toInstant: (local: LocalDateTime, timeZone: string, disambiguation: Disambiguation) => Instant;
230
+ /** Offset-transition instants in `[start, end)`. */
231
+ readonly getTimeZoneTransitions: (timeZone: string, start: Instant, end: Instant) => readonly Instant[];
232
+ readonly createCalendarDateFormatter: (options: CalendarDateFormatterOptions) => CalendarDateFormatter;
233
+ readonly createInstantFormatter: (options: InstantFormatterOptions) => InstantFormatter;
234
+ }
235
+ export { knownCalendarSystems as A, LocalTimeResolution as C, ZonedDateTimeFields as D, Weekday as E, CalendarSystem as O, LocalDateTime as S, WallClockTime as T, DayStart as _, CalendarDateFormatterOptions as a, InstantInterval as b, InstantFormatterOptions as c, CalendarDateChange as d, CalendarDateFields as f, CalendarPeriodUnit as g, CalendarPeriod as h, CalendarDateFormatter as i, isKnownCalendarSystem as k, ResolvedFormatInfo as l, CalendarDuration as m, IsoWeek as n, InstantFormatOptions as o, CalendarDateInput as p, CalendarDateFormatOptions as r, InstantFormatter as s, DateEngine as t, CalendarDate as u, Disambiguation as v, Overflow as w, IsoDateFields as x, Instant as y };
@@ -0,0 +1,83 @@
1
+ import { A as knownCalendarSystems, C as LocalTimeResolution, D as ZonedDateTimeFields, E as Weekday, O as CalendarSystem, S as LocalDateTime, T as WallClockTime, _ as DayStart, a as CalendarDateFormatterOptions, b as InstantInterval, c as InstantFormatterOptions, d as CalendarDateChange, f as CalendarDateFields, g as CalendarPeriodUnit, h as CalendarPeriod, i as CalendarDateFormatter, k as isKnownCalendarSystem, l as ResolvedFormatInfo, m as CalendarDuration, n as IsoWeek, o as InstantFormatOptions, p as CalendarDateInput, r as CalendarDateFormatOptions, s as InstantFormatter, t as DateEngine, u as CalendarDate, v as Disambiguation, w as Overflow, x as IsoDateFields, y as Instant } from "./date-engine-CaLe_SPQ.js";
2
+ type CalendarErrorCode = "INVALID_DATE" | "DATE_OUT_OF_RANGE" | "CALENDAR_SYSTEM_NOT_SUPPORTED" | "INVALID_TIME_ZONE" | "INVALID_CALENDAR_FIELDS" | "NONEXISTENT_LOCAL_TIME" | "AMBIGUOUS_LOCAL_TIME" | "FORMATTING_NOT_SUPPORTED" | "INVALID_CONFIGURATION";
3
+ /** Base class of every error thrown by the library. */
4
+ export declare class CalendarError extends Error {
5
+ readonly code: CalendarErrorCode;
6
+ constructor(code: CalendarErrorCode, message: string, options?: ErrorOptions);
7
+ }
8
+ export declare class InvalidDateError extends CalendarError {
9
+ constructor(label: string, options?: ErrorOptions);
10
+ }
11
+ export declare class DateRangeError extends CalendarError {
12
+ constructor(message: string, options?: ErrorOptions);
13
+ }
14
+ export declare class CalendarSystemNotSupportedError extends CalendarError {
15
+ readonly calendarSystem: string;
16
+ readonly supportedCalendarSystems: readonly CalendarSystem[];
17
+ constructor(calendarSystem: string, engineName: string, supported: readonly CalendarSystem[], options?: ErrorOptions);
18
+ }
19
+ export declare class InvalidTimeZoneError extends CalendarError {
20
+ readonly timeZone: string;
21
+ constructor(timeZone: string, options?: ErrorOptions);
22
+ }
23
+ export declare class InvalidCalendarFieldsError extends CalendarError {
24
+ constructor(message: string, options?: ErrorOptions);
25
+ }
26
+ export declare class NonexistentLocalTimeError extends CalendarError {
27
+ constructor(message: string);
28
+ }
29
+ export declare class AmbiguousLocalTimeError extends CalendarError {
30
+ constructor(message: string);
31
+ }
32
+ export declare class FormattingNotSupportedError extends CalendarError {
33
+ constructor(message: string);
34
+ }
35
+ export declare class CalendarConfigurationError extends CalendarError {
36
+ constructor(message: string, options?: ErrorOptions);
37
+ }
38
+ interface LocaleWeekInfo {
39
+ readonly firstDay: Weekday;
40
+ readonly weekend: readonly Weekday[];
41
+ /** Minimal days in the first week; undefined when the runtime does not provide it. */
42
+ readonly minimalDays?: number;
43
+ }
44
+ type TextDirection = "ltr" | "rtl";
45
+ /** Converts Intl/ISO weekday numbering (1 = Monday … 7 = Sunday) to the public convention. */
46
+ export declare function weekdayFromIsoNumber(isoWeekday: number): Weekday;
47
+ /**
48
+ * Week conventions of a locale from `Intl.Locale` week info.
49
+ * Returns undefined when the runtime does not expose week info; callers choose an explicit fallback.
50
+ */
51
+ export declare function getLocaleWeekInfo(locale: string): LocaleWeekInfo | undefined;
52
+ /** Text direction of a locale, or undefined when the runtime does not expose it. */
53
+ export declare function getLocaleTextDirection(locale: string): TextDirection | undefined;
54
+ /** The largest absolute epoch-millisecond value representable by `Date`. */
55
+ export declare const maxEpochMilliseconds = 864e13;
56
+ export declare function isValidDate(value: unknown): value is Date;
57
+ /**
58
+ * Converts a native Date into an instant. Never mutates or retains the Date.
59
+ * Throws `InvalidDateError` for non-Date values and Invalid Date.
60
+ */
61
+ export declare function instantFromDate(date: Date, label?: string): Instant;
62
+ /** Validates epoch milliseconds and brands them as an instant. */
63
+ export declare function instantFromEpochMilliseconds(epochMilliseconds: number): Instant;
64
+ /** Creates a new Date for an instant. Each call returns a fresh object. */
65
+ export declare function dateFromInstant(instant: Instant): Date;
66
+ /** Adds elapsed (not wall-clock) milliseconds. */
67
+ export declare function addMilliseconds(instant: Instant, milliseconds: number): Instant;
68
+ export declare function compareInstants(a: Instant, b: Instant): -1 | 0 | 1;
69
+ export declare function createInterval(start: Instant, end: Instant): InstantInterval;
70
+ /** Elapsed milliseconds of a half-open interval. */
71
+ export declare function intervalDuration(interval: InstantInterval): number;
72
+ export declare function isEmptyInterval(interval: InstantInterval): boolean;
73
+ /**
74
+ * Whether two half-open intervals share at least one instant.
75
+ * Adjacent intervals (`a.end === b.start`) do not overlap.
76
+ * A zero-duration interval overlaps an interval that contains its instant.
77
+ */
78
+ export declare function intervalsOverlap(a: InstantInterval, b: InstantInterval): boolean;
79
+ /** The common part of two intervals, or `undefined` when they do not overlap. */
80
+ export declare function intersectIntervals(a: InstantInterval, b: InstantInterval): InstantInterval | undefined;
81
+ /** Whether `instant` lies in `[start, end)`. */
82
+ export declare function intervalContains(interval: InstantInterval, instant: Instant): boolean;
83
+ export { type CalendarDate, type CalendarDateChange, type CalendarDateFields, type CalendarDateFormatOptions, type CalendarDateFormatter, type CalendarDateFormatterOptions, type CalendarDateInput, type CalendarDuration, type CalendarErrorCode, type CalendarPeriod, type CalendarPeriodUnit, type CalendarSystem, type DateEngine, type DayStart, type Disambiguation, type Instant, type InstantFormatOptions, type InstantFormatter, type InstantFormatterOptions, type InstantInterval, type IsoDateFields, type IsoWeek, type LocalDateTime, type LocalTimeResolution, type LocaleWeekInfo, type Overflow, type ResolvedFormatInfo, type TextDirection, type WallClockTime, type Weekday, type ZonedDateTimeFields, isKnownCalendarSystem, knownCalendarSystems };
package/dist/index.js ADDED
@@ -0,0 +1,43 @@
1
+ import { S as knownCalendarSystems, _ as InvalidCalendarFieldsError, a as instantFromEpochMilliseconds, b as NonexistentLocalTimeError, c as getLocaleTextDirection, d as AmbiguousLocalTimeError, f as CalendarConfigurationError, g as FormattingNotSupportedError, h as DateRangeError, i as instantFromDate, l as getLocaleWeekInfo, m as CalendarSystemNotSupportedError, n as compareInstants, o as isValidDate, p as CalendarError, r as dateFromInstant, s as maxEpochMilliseconds, t as addMilliseconds, u as weekdayFromIsoNumber, v as InvalidDateError, x as isKnownCalendarSystem, y as InvalidTimeZoneError } from "./instant-h91-6kZL.js";
2
+ // src/operations/interval.ts
3
+ function createInterval(start, end) {
4
+ if (end < start) throw new DateRangeError(`Interval end (${end}) is before its start (${start}).`);
5
+ return {
6
+ start,
7
+ end
8
+ };
9
+ }
10
+ /** Elapsed milliseconds of a half-open interval. */
11
+ function intervalDuration(interval) {
12
+ return interval.end - interval.start;
13
+ }
14
+ function isEmptyInterval(interval) {
15
+ return interval.end === interval.start;
16
+ }
17
+ /**
18
+ * Whether two half-open intervals share at least one instant.
19
+ * Adjacent intervals (`a.end === b.start`) do not overlap.
20
+ * A zero-duration interval overlaps an interval that contains its instant.
21
+ */
22
+ function intervalsOverlap(a, b) {
23
+ if (isEmptyInterval(a)) return intervalContains(b, a.start);
24
+ if (isEmptyInterval(b)) return intervalContains(a, b.start);
25
+ return a.start < b.end && b.start < a.end;
26
+ }
27
+ /** The common part of two intervals, or `undefined` when they do not overlap. */
28
+ function intersectIntervals(a, b) {
29
+ if (!intervalsOverlap(a, b)) return void 0;
30
+ const start = a.start > b.start ? a.start : b.start;
31
+ const end = a.end < b.end ? a.end : b.end;
32
+ return {
33
+ start,
34
+ end: end < start ? start : end
35
+ };
36
+ }
37
+ /** Whether `instant` lies in `[start, end)`. */
38
+ function intervalContains(interval, instant) {
39
+ return instant >= interval.start && instant < interval.end;
40
+ }
41
+ export { AmbiguousLocalTimeError, CalendarConfigurationError, CalendarError, CalendarSystemNotSupportedError, DateRangeError, FormattingNotSupportedError, InvalidCalendarFieldsError, InvalidDateError, InvalidTimeZoneError, NonexistentLocalTimeError, addMilliseconds, compareInstants, createInterval, dateFromInstant, getLocaleTextDirection, getLocaleWeekInfo, instantFromDate, instantFromEpochMilliseconds, intersectIntervals, intervalContains, intervalDuration, intervalsOverlap, isEmptyInterval, isKnownCalendarSystem, isValidDate, knownCalendarSystems, maxEpochMilliseconds, weekdayFromIsoNumber };
42
+
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/operations/interval.ts"],"sourcesContent":["import type { Instant, InstantInterval } from '../contracts/date-types'\nimport { DateRangeError } from '../contracts/errors'\n\nexport function createInterval(start: Instant, end: Instant): InstantInterval {\n if (end < start) {\n throw new DateRangeError(`Interval end (${end}) is before its start (${start}).`)\n }\n return { start, end }\n}\n\n/** Elapsed milliseconds of a half-open interval. */\nexport function intervalDuration(interval: InstantInterval): number {\n return interval.end - interval.start\n}\n\nexport function isEmptyInterval(interval: InstantInterval): boolean {\n return interval.end === interval.start\n}\n\n/**\n * Whether two half-open intervals share at least one instant.\n * Adjacent intervals (`a.end === b.start`) do not overlap.\n * A zero-duration interval overlaps an interval that contains its instant.\n */\nexport function intervalsOverlap(a: InstantInterval, b: InstantInterval): boolean {\n if (isEmptyInterval(a)) return intervalContains(b, a.start)\n if (isEmptyInterval(b)) return intervalContains(a, b.start)\n return a.start < b.end && b.start < a.end\n}\n\n/** The common part of two intervals, or `undefined` when they do not overlap. */\nexport function intersectIntervals(\n a: InstantInterval,\n b: InstantInterval,\n): InstantInterval | undefined {\n if (!intervalsOverlap(a, b)) return undefined\n const start = a.start > b.start ? a.start : b.start\n const end = a.end < b.end ? a.end : b.end\n return { start, end: end < start ? start : end }\n}\n\n/** Whether `instant` lies in `[start, end)`. */\nexport function intervalContains(interval: InstantInterval, instant: Instant): boolean {\n return instant >= interval.start && instant < interval.end\n}\n"],"mappings":";;AAGA,SAAgB,eAAe,OAAgB,KAA+B;CAC5E,IAAI,MAAM,OACR,MAAM,IAAI,eAAe,iBAAiB,IAAI,yBAAyB,MAAM,GAAG;CAElF,OAAO;EAAE;EAAO;CAAI;AACtB;;AAGA,SAAgB,iBAAiB,UAAmC;CAClE,OAAO,SAAS,MAAM,SAAS;AACjC;AAEA,SAAgB,gBAAgB,UAAoC;CAClE,OAAO,SAAS,QAAQ,SAAS;AACnC;;;;;;AAOA,SAAgB,iBAAiB,GAAoB,GAA6B;CAChF,IAAI,gBAAgB,CAAC,GAAG,OAAO,iBAAiB,GAAG,EAAE,KAAK;CAC1D,IAAI,gBAAgB,CAAC,GAAG,OAAO,iBAAiB,GAAG,EAAE,KAAK;CAC1D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE;AACxC;;AAGA,SAAgB,mBACd,GACA,GAC6B;CAC7B,IAAI,CAAC,iBAAiB,GAAG,CAAC,GAAG,OAAO,KAAA;CACpC,MAAM,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE;CAC9C,MAAM,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;CACtC,OAAO;EAAE;EAAO,KAAK,MAAM,QAAQ,QAAQ;CAAI;AACjD;;AAGA,SAAgB,iBAAiB,UAA2B,SAA2B;CACrF,OAAO,WAAW,SAAS,SAAS,UAAU,SAAS;AACzD"}
@@ -0,0 +1,169 @@
1
+ // src/contracts/calendar-system.ts
2
+ const knownCalendarSystems = [
3
+ "iso8601",
4
+ "gregory",
5
+ "buddhist",
6
+ "chinese",
7
+ "coptic",
8
+ "dangi",
9
+ "ethiopic",
10
+ "ethioaa",
11
+ "hebrew",
12
+ "indian",
13
+ "islamic-civil",
14
+ "islamic-tbla",
15
+ "islamic-umalqura",
16
+ "japanese",
17
+ "persian",
18
+ "roc"
19
+ ];
20
+ const knownCalendarSystemSet = new Set(knownCalendarSystems);
21
+ function isKnownCalendarSystem(value) {
22
+ return knownCalendarSystemSet.has(value);
23
+ }
24
+ // src/contracts/errors.ts
25
+ /** Base class of every error thrown by the library. */
26
+ var CalendarError = class extends Error {
27
+ code;
28
+ constructor(code, message, options) {
29
+ super(message, options);
30
+ this.name = "CalendarError";
31
+ this.code = code;
32
+ }
33
+ };
34
+ var InvalidDateError = class extends CalendarError {
35
+ constructor(label, options) {
36
+ super("INVALID_DATE", `${label} must be a valid Date instance.`, options);
37
+ this.name = "InvalidDateError";
38
+ }
39
+ };
40
+ var DateRangeError = class extends CalendarError {
41
+ constructor(message, options) {
42
+ super("DATE_OUT_OF_RANGE", message, options);
43
+ this.name = "DateRangeError";
44
+ }
45
+ };
46
+ var CalendarSystemNotSupportedError = class extends CalendarError {
47
+ calendarSystem;
48
+ supportedCalendarSystems;
49
+ constructor(calendarSystem, engineName, supported, options) {
50
+ super("CALENDAR_SYSTEM_NOT_SUPPORTED", `Calendar system "${calendarSystem}" is not supported by the "${engineName}" date engine. Supported: ${supported.join(", ")}.`, options);
51
+ this.name = "CalendarSystemNotSupportedError";
52
+ this.calendarSystem = calendarSystem;
53
+ this.supportedCalendarSystems = supported;
54
+ }
55
+ };
56
+ var InvalidTimeZoneError = class extends CalendarError {
57
+ timeZone;
58
+ constructor(timeZone, options) {
59
+ super("INVALID_TIME_ZONE", `"${timeZone}" is not a supported IANA time zone.`, options);
60
+ this.name = "InvalidTimeZoneError";
61
+ this.timeZone = timeZone;
62
+ }
63
+ };
64
+ var InvalidCalendarFieldsError = class extends CalendarError {
65
+ constructor(message, options) {
66
+ super("INVALID_CALENDAR_FIELDS", message, options);
67
+ this.name = "InvalidCalendarFieldsError";
68
+ }
69
+ };
70
+ var NonexistentLocalTimeError = class extends CalendarError {
71
+ constructor(message) {
72
+ super("NONEXISTENT_LOCAL_TIME", message);
73
+ this.name = "NonexistentLocalTimeError";
74
+ }
75
+ };
76
+ var AmbiguousLocalTimeError = class extends CalendarError {
77
+ constructor(message) {
78
+ super("AMBIGUOUS_LOCAL_TIME", message);
79
+ this.name = "AmbiguousLocalTimeError";
80
+ }
81
+ };
82
+ var FormattingNotSupportedError = class extends CalendarError {
83
+ constructor(message) {
84
+ super("FORMATTING_NOT_SUPPORTED", message);
85
+ this.name = "FormattingNotSupportedError";
86
+ }
87
+ };
88
+ var CalendarConfigurationError = class extends CalendarError {
89
+ constructor(message, options) {
90
+ super("INVALID_CONFIGURATION", message, options);
91
+ this.name = "CalendarConfigurationError";
92
+ }
93
+ };
94
+ // src/formatting/locale-info.ts
95
+ /** Converts Intl/ISO weekday numbering (1 = Monday … 7 = Sunday) to the public convention. */
96
+ function weekdayFromIsoNumber(isoWeekday) {
97
+ switch (isoWeekday) {
98
+ case 7: return 0;
99
+ case 1: return 1;
100
+ case 2: return 2;
101
+ case 3: return 3;
102
+ case 4: return 4;
103
+ case 5: return 5;
104
+ case 6: return 6;
105
+ default: throw new RangeError(`Invalid ISO weekday number: ${isoWeekday}`);
106
+ }
107
+ }
108
+ function localeInfo(locale) {
109
+ return new Intl.Locale(locale);
110
+ }
111
+ /**
112
+ * Week conventions of a locale from `Intl.Locale` week info.
113
+ * Returns undefined when the runtime does not expose week info; callers choose an explicit fallback.
114
+ */
115
+ function getLocaleWeekInfo(locale) {
116
+ const info = localeInfo(locale);
117
+ const raw = info.getWeekInfo?.() ?? info.weekInfo;
118
+ if (raw === void 0) return void 0;
119
+ const base = {
120
+ firstDay: weekdayFromIsoNumber(raw.firstDay),
121
+ weekend: raw.weekend.map(weekdayFromIsoNumber)
122
+ };
123
+ return raw.minimalDays === void 0 ? base : {
124
+ ...base,
125
+ minimalDays: raw.minimalDays
126
+ };
127
+ }
128
+ /** Text direction of a locale, or undefined when the runtime does not expose it. */
129
+ function getLocaleTextDirection(locale) {
130
+ const info = localeInfo(locale);
131
+ const direction = (info.getTextInfo?.() ?? info.textInfo)?.direction;
132
+ return direction === "rtl" || direction === "ltr" ? direction : void 0;
133
+ }
134
+ // src/operations/instant.ts
135
+ /** The largest absolute epoch-millisecond value representable by `Date`. */
136
+ const maxEpochMilliseconds = 864e13;
137
+ function isValidDate(value) {
138
+ return value instanceof Date && !Number.isNaN(value.getTime());
139
+ }
140
+ /**
141
+ * Converts a native Date into an instant. Never mutates or retains the Date.
142
+ * Throws `InvalidDateError` for non-Date values and Invalid Date.
143
+ */
144
+ function instantFromDate(date, label = "Date") {
145
+ if (!isValidDate(date)) throw new InvalidDateError(label);
146
+ return date.getTime();
147
+ }
148
+ /** Validates epoch milliseconds and brands them as an instant. */
149
+ function instantFromEpochMilliseconds(epochMilliseconds) {
150
+ if (!Number.isInteger(epochMilliseconds)) throw new DateRangeError(`Epoch milliseconds must be an integer, received ${String(epochMilliseconds)}.`);
151
+ if (Math.abs(epochMilliseconds) > 864e13) throw new DateRangeError(`Epoch milliseconds ${epochMilliseconds} is outside the supported range.`);
152
+ return epochMilliseconds;
153
+ }
154
+ /** Creates a new Date for an instant. Each call returns a fresh object. */
155
+ function dateFromInstant(instant) {
156
+ return new Date(instant);
157
+ }
158
+ /** Adds elapsed (not wall-clock) milliseconds. */
159
+ function addMilliseconds(instant, milliseconds) {
160
+ return instantFromEpochMilliseconds(instant + milliseconds);
161
+ }
162
+ function compareInstants(a, b) {
163
+ if (a < b) return -1;
164
+ if (a > b) return 1;
165
+ return 0;
166
+ }
167
+ export { knownCalendarSystems as S, InvalidCalendarFieldsError as _, instantFromEpochMilliseconds as a, NonexistentLocalTimeError as b, getLocaleTextDirection as c, AmbiguousLocalTimeError as d, CalendarConfigurationError as f, FormattingNotSupportedError as g, DateRangeError as h, instantFromDate as i, getLocaleWeekInfo as l, CalendarSystemNotSupportedError as m, compareInstants as n, isValidDate as o, CalendarError as p, dateFromInstant as r, maxEpochMilliseconds as s, addMilliseconds as t, weekdayFromIsoNumber as u, InvalidDateError as v, isKnownCalendarSystem as x, InvalidTimeZoneError as y };
168
+
169
+ //# sourceMappingURL=instant-h91-6kZL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instant-h91-6kZL.js","names":[],"sources":["../src/contracts/calendar-system.ts","../src/contracts/errors.ts","../src/formatting/locale-info.ts","../src/operations/instant.ts"],"sourcesContent":["/**\n * Calendar system identifiers known to the library (CLDR / Temporal identifiers).\n *\n * Whether a given identifier is usable depends on the configured date engine.\n * Use `engine.getSupportedCalendarSystems()` for the actual capabilities.\n */\nexport type CalendarSystem =\n | 'iso8601'\n | 'gregory'\n | 'buddhist'\n | 'chinese'\n | 'coptic'\n | 'dangi'\n | 'ethiopic'\n | 'ethioaa'\n | 'hebrew'\n | 'indian'\n | 'islamic-civil'\n | 'islamic-tbla'\n | 'islamic-umalqura'\n | 'japanese'\n | 'persian'\n | 'roc'\n\nexport const knownCalendarSystems: readonly CalendarSystem[] = [\n 'iso8601',\n 'gregory',\n 'buddhist',\n 'chinese',\n 'coptic',\n 'dangi',\n 'ethiopic',\n 'ethioaa',\n 'hebrew',\n 'indian',\n 'islamic-civil',\n 'islamic-tbla',\n 'islamic-umalqura',\n 'japanese',\n 'persian',\n 'roc',\n]\n\nconst knownCalendarSystemSet: ReadonlySet<string> = new Set(knownCalendarSystems)\n\nexport function isKnownCalendarSystem(value: string): value is CalendarSystem {\n return knownCalendarSystemSet.has(value)\n}\n","import type { CalendarSystem } from './calendar-system'\n\nexport type CalendarErrorCode =\n | 'INVALID_DATE'\n | 'DATE_OUT_OF_RANGE'\n | 'CALENDAR_SYSTEM_NOT_SUPPORTED'\n | 'INVALID_TIME_ZONE'\n | 'INVALID_CALENDAR_FIELDS'\n | 'NONEXISTENT_LOCAL_TIME'\n | 'AMBIGUOUS_LOCAL_TIME'\n | 'FORMATTING_NOT_SUPPORTED'\n | 'INVALID_CONFIGURATION'\n\n/** Base class of every error thrown by the library. */\nexport class CalendarError extends Error {\n readonly code: CalendarErrorCode\n\n constructor(code: CalendarErrorCode, message: string, options?: ErrorOptions) {\n super(message, options)\n this.name = 'CalendarError'\n this.code = code\n }\n}\n\nexport class InvalidDateError extends CalendarError {\n constructor(label: string, options?: ErrorOptions) {\n super('INVALID_DATE', `${label} must be a valid Date instance.`, options)\n this.name = 'InvalidDateError'\n }\n}\n\nexport class DateRangeError extends CalendarError {\n constructor(message: string, options?: ErrorOptions) {\n super('DATE_OUT_OF_RANGE', message, options)\n this.name = 'DateRangeError'\n }\n}\n\nexport class CalendarSystemNotSupportedError extends CalendarError {\n readonly calendarSystem: string\n readonly supportedCalendarSystems: readonly CalendarSystem[]\n\n constructor(\n calendarSystem: string,\n engineName: string,\n supported: readonly CalendarSystem[],\n options?: ErrorOptions,\n ) {\n super(\n 'CALENDAR_SYSTEM_NOT_SUPPORTED',\n `Calendar system \"${calendarSystem}\" is not supported by the \"${engineName}\" date engine. ` +\n `Supported: ${supported.join(', ')}.`,\n options,\n )\n this.name = 'CalendarSystemNotSupportedError'\n this.calendarSystem = calendarSystem\n this.supportedCalendarSystems = supported\n }\n}\n\nexport class InvalidTimeZoneError extends CalendarError {\n readonly timeZone: string\n\n constructor(timeZone: string, options?: ErrorOptions) {\n super('INVALID_TIME_ZONE', `\"${timeZone}\" is not a supported IANA time zone.`, options)\n this.name = 'InvalidTimeZoneError'\n this.timeZone = timeZone\n }\n}\n\nexport class InvalidCalendarFieldsError extends CalendarError {\n constructor(message: string, options?: ErrorOptions) {\n super('INVALID_CALENDAR_FIELDS', message, options)\n this.name = 'InvalidCalendarFieldsError'\n }\n}\n\nexport class NonexistentLocalTimeError extends CalendarError {\n constructor(message: string) {\n super('NONEXISTENT_LOCAL_TIME', message)\n this.name = 'NonexistentLocalTimeError'\n }\n}\n\nexport class AmbiguousLocalTimeError extends CalendarError {\n constructor(message: string) {\n super('AMBIGUOUS_LOCAL_TIME', message)\n this.name = 'AmbiguousLocalTimeError'\n }\n}\n\nexport class FormattingNotSupportedError extends CalendarError {\n constructor(message: string) {\n super('FORMATTING_NOT_SUPPORTED', message)\n this.name = 'FormattingNotSupportedError'\n }\n}\n\nexport class CalendarConfigurationError extends CalendarError {\n constructor(message: string, options?: ErrorOptions) {\n super('INVALID_CONFIGURATION', message, options)\n this.name = 'CalendarConfigurationError'\n }\n}\n","import type { Weekday } from '../contracts/date-types'\n\nexport interface LocaleWeekInfo {\n readonly firstDay: Weekday\n readonly weekend: readonly Weekday[]\n /** Minimal days in the first week; undefined when the runtime does not provide it. */\n readonly minimalDays?: number\n}\n\nexport type TextDirection = 'ltr' | 'rtl'\n\ninterface RawWeekInfo {\n readonly firstDay: number\n readonly weekend: readonly number[]\n readonly minimalDays?: number\n}\n\n/** `Intl.Locale` with week and text info, which TypeScript's standard library does not declare yet. */\ninterface LocaleWithInfo {\n readonly baseName: string\n getWeekInfo?: () => RawWeekInfo\n weekInfo?: RawWeekInfo\n getTextInfo?: () => { direction?: string }\n textInfo?: { direction?: string }\n}\n\n/** Converts Intl/ISO weekday numbering (1 = Monday … 7 = Sunday) to the public convention. */\nexport function weekdayFromIsoNumber(isoWeekday: number): Weekday {\n switch (isoWeekday) {\n case 7:\n return 0\n case 1:\n return 1\n case 2:\n return 2\n case 3:\n return 3\n case 4:\n return 4\n case 5:\n return 5\n case 6:\n return 6\n default:\n throw new RangeError(`Invalid ISO weekday number: ${isoWeekday}`)\n }\n}\n\nfunction localeInfo(locale: string): LocaleWithInfo {\n return new Intl.Locale(locale)\n}\n\n/**\n * Week conventions of a locale from `Intl.Locale` week info.\n * Returns undefined when the runtime does not expose week info; callers choose an explicit fallback.\n */\nexport function getLocaleWeekInfo(locale: string): LocaleWeekInfo | undefined {\n const info = localeInfo(locale)\n const raw = info.getWeekInfo?.() ?? info.weekInfo\n if (raw === undefined) return undefined\n const base = {\n firstDay: weekdayFromIsoNumber(raw.firstDay),\n weekend: raw.weekend.map(weekdayFromIsoNumber),\n }\n return raw.minimalDays === undefined ? base : { ...base, minimalDays: raw.minimalDays }\n}\n\n/** Text direction of a locale, or undefined when the runtime does not expose it. */\nexport function getLocaleTextDirection(locale: string): TextDirection | undefined {\n const info = localeInfo(locale)\n const direction = (info.getTextInfo?.() ?? info.textInfo)?.direction\n return direction === 'rtl' || direction === 'ltr' ? direction : undefined\n}\n","import type { Instant } from '../contracts/date-types'\nimport { DateRangeError, InvalidDateError } from '../contracts/errors'\n\n/** The largest absolute epoch-millisecond value representable by `Date`. */\nexport const maxEpochMilliseconds = 8.64e15\n\nexport function isValidDate(value: unknown): value is Date {\n return value instanceof Date && !Number.isNaN(value.getTime())\n}\n\n/**\n * Converts a native Date into an instant. Never mutates or retains the Date.\n * Throws `InvalidDateError` for non-Date values and Invalid Date.\n */\nexport function instantFromDate(date: Date, label = 'Date'): Instant {\n if (!isValidDate(date)) throw new InvalidDateError(label)\n return date.getTime() as Instant\n}\n\n/** Validates epoch milliseconds and brands them as an instant. */\nexport function instantFromEpochMilliseconds(epochMilliseconds: number): Instant {\n if (!Number.isInteger(epochMilliseconds)) {\n throw new DateRangeError(\n `Epoch milliseconds must be an integer, received ${String(epochMilliseconds)}.`,\n )\n }\n if (Math.abs(epochMilliseconds) > maxEpochMilliseconds) {\n throw new DateRangeError(\n `Epoch milliseconds ${epochMilliseconds} is outside the supported range.`,\n )\n }\n return epochMilliseconds as Instant\n}\n\n/** Creates a new Date for an instant. Each call returns a fresh object. */\nexport function dateFromInstant(instant: Instant): Date {\n return new Date(instant)\n}\n\n/** Adds elapsed (not wall-clock) milliseconds. */\nexport function addMilliseconds(instant: Instant, milliseconds: number): Instant {\n return instantFromEpochMilliseconds(instant + milliseconds)\n}\n\nexport function compareInstants(a: Instant, b: Instant): -1 | 0 | 1 {\n if (a < b) return -1\n if (a > b) return 1\n return 0\n}\n"],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ import { t as DateEngine } from "./date-engine-CaLe_SPQ.js";
2
+ /**
3
+ * Smaller date engine that supports only the `iso8601` and `gregory` calendar systems
4
+ * (`temporal-polyfill/implementation`). Other calendars throw `CalendarSystemNotSupportedError`.
5
+ */
6
+ export declare function createGregorianDateEngine(): DateEngine;
@@ -0,0 +1,16 @@
1
+ import { Temporal } from "temporal-polyfill/implementation";
2
+ import { t as createTemporalEngine } from "./create-temporal-engine-CJDDY96Y.js";
3
+ // src/temporal/gregorian-engine.ts
4
+ /**
5
+ * Smaller date engine that supports only the `iso8601` and `gregory` calendar systems
6
+ * (`temporal-polyfill/implementation`). Other calendars throw `CalendarSystemNotSupportedError`.
7
+ */
8
+ function createGregorianDateEngine() {
9
+ return createTemporalEngine({
10
+ name: "temporal-polyfill/gregorian",
11
+ Temporal
12
+ });
13
+ }
14
+ export { createGregorianDateEngine };
15
+
16
+ //# sourceMappingURL=temporal-gregorian.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temporal-gregorian.js","names":[],"sources":["../src/temporal/gregorian-engine.ts"],"sourcesContent":["import { Temporal } from 'temporal-polyfill/implementation'\nimport type { DateEngine } from '../contracts/date-engine'\nimport { createTemporalEngine } from './create-temporal-engine'\n\n/**\n * Smaller date engine that supports only the `iso8601` and `gregory` calendar systems\n * (`temporal-polyfill/implementation`). Other calendars throw `CalendarSystemNotSupportedError`.\n */\nexport function createGregorianDateEngine(): DateEngine {\n return createTemporalEngine({ name: 'temporal-polyfill/gregorian', Temporal })\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,4BAAwC;CACtD,OAAO,qBAAqB;EAAE,MAAM;EAA+B;CAAS,CAAC;AAC/E"}
@@ -0,0 +1,6 @@
1
+ import { t as DateEngine } from "./date-engine-CaLe_SPQ.js";
2
+ /**
3
+ * Date engine with every calendar system supported by temporal-polyfill
4
+ * (`temporal-polyfill/full/implementation`). Never uses or installs a global Temporal.
5
+ */
6
+ export declare function createTemporalDateEngine(): DateEngine;
@@ -0,0 +1,16 @@
1
+ import { Temporal } from "temporal-polyfill/full/implementation";
2
+ import { t as createTemporalEngine } from "./create-temporal-engine-CJDDY96Y.js";
3
+ // src/temporal/full-engine.ts
4
+ /**
5
+ * Date engine with every calendar system supported by temporal-polyfill
6
+ * (`temporal-polyfill/full/implementation`). Never uses or installs a global Temporal.
7
+ */
8
+ function createTemporalDateEngine() {
9
+ return createTemporalEngine({
10
+ name: "temporal-polyfill/full",
11
+ Temporal
12
+ });
13
+ }
14
+ export { createTemporalDateEngine };
15
+
16
+ //# sourceMappingURL=temporal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temporal.js","names":[],"sources":["../src/temporal/full-engine.ts"],"sourcesContent":["import { Temporal } from 'temporal-polyfill/full/implementation'\nimport type { DateEngine } from '../contracts/date-engine'\nimport { createTemporalEngine } from './create-temporal-engine'\n\n/**\n * Date engine with every calendar system supported by temporal-polyfill\n * (`temporal-polyfill/full/implementation`). Never uses or installs a global Temporal.\n */\nexport function createTemporalDateEngine(): DateEngine {\n return createTemporalEngine({ name: 'temporal-polyfill/full', Temporal })\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,2BAAuC;CACrD,OAAO,qBAAqB;EAAE,MAAM;EAA0B;CAAS,CAAC;AAC1E"}