@c9up/chronos 0.1.3 → 0.1.5
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/DateTime.d.ts +108 -0
- package/dist/DateTime.d.ts.map +1 -0
- package/dist/DateTime.js +506 -0
- package/dist/DateTime.js.map +1 -0
- package/dist/Duration.d.ts +108 -0
- package/dist/Duration.d.ts.map +1 -0
- package/dist/Duration.js +397 -0
- package/dist/Duration.js.map +1 -0
- package/dist/Interval.d.ts +61 -0
- package/dist/Interval.d.ts.map +1 -0
- package/dist/Interval.js +168 -0
- package/dist/Interval.js.map +1 -0
- package/dist/atlas.d.ts +120 -0
- package/dist/atlas.d.ts.map +1 -0
- package/dist/atlas.js +163 -0
- package/dist/atlas.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/native.d.ts +47 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +77 -0
- package/dist/native.js.map +1 -0
- package/dist/rrule.d.ts +21 -0
- package/dist/rrule.d.ts.map +1 -0
- package/dist/rrule.js +58 -0
- package/dist/rrule.js.map +1 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +12 -0
- package/dist/utils.js.map +1 -0
- package/index.darwin-arm64.node +0 -0
- package/index.darwin-x64.node +0 -0
- package/index.linux-arm64-gnu.node +0 -0
- package/index.linux-x64-gnu.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
- package/src/Duration.ts +103 -32
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Duration — immutable time-span value object for the Ream framework.
|
|
3
|
+
*
|
|
4
|
+
* Represents a length of time as a bag of calendar + clock units. Closely
|
|
5
|
+
* mirrors Luxon's `Duration` API so developers coming from AdonisJS feel at
|
|
6
|
+
* home. Pure TypeScript — no Rust/NAPI dependency (durations are lightweight
|
|
7
|
+
* arithmetic on small integers, not worth an FFI crossing).
|
|
8
|
+
*
|
|
9
|
+
* @implements Story 36.8
|
|
10
|
+
*/
|
|
11
|
+
export interface DurationObject {
|
|
12
|
+
years?: number;
|
|
13
|
+
months?: number;
|
|
14
|
+
weeks?: number;
|
|
15
|
+
days?: number;
|
|
16
|
+
hours?: number;
|
|
17
|
+
minutes?: number;
|
|
18
|
+
seconds?: number;
|
|
19
|
+
milliseconds?: number;
|
|
20
|
+
}
|
|
21
|
+
export type DurationUnit = keyof DurationObject;
|
|
22
|
+
export declare class Duration {
|
|
23
|
+
#private;
|
|
24
|
+
private constructor();
|
|
25
|
+
/** Build from a plain object of unit values. */
|
|
26
|
+
static fromObject(obj: DurationObject): Duration;
|
|
27
|
+
/** Build from a total number of milliseconds (approximates calendar units). */
|
|
28
|
+
static fromMillis(ms: number): Duration;
|
|
29
|
+
/**
|
|
30
|
+
* Parse an ISO 8601 duration string (`P1Y2M3DT4H5M6.789S`).
|
|
31
|
+
*
|
|
32
|
+
* Supports the full `PnYnMnDTnHnMnS` form. Fractional seconds are
|
|
33
|
+
* rounded to the nearest millisecond. Weeks (`PnW`) are a separate form
|
|
34
|
+
* that cannot be mixed with other designators per the spec.
|
|
35
|
+
*/
|
|
36
|
+
static fromISO(iso: string): Duration;
|
|
37
|
+
get years(): number;
|
|
38
|
+
get months(): number;
|
|
39
|
+
get weeks(): number;
|
|
40
|
+
get days(): number;
|
|
41
|
+
get hours(): number;
|
|
42
|
+
get minutes(): number;
|
|
43
|
+
get seconds(): number;
|
|
44
|
+
get milliseconds(): number;
|
|
45
|
+
/** Get a specific unit. */
|
|
46
|
+
get(unit: DurationUnit): number;
|
|
47
|
+
/** Return the internal bag as a plain object. */
|
|
48
|
+
toObject(): Required<DurationObject>;
|
|
49
|
+
/** Add another duration to this one (per-unit addition). */
|
|
50
|
+
plus(other: Duration | DurationObject): Duration;
|
|
51
|
+
/** Subtract another duration from this one. */
|
|
52
|
+
minus(other: Duration | DurationObject): Duration;
|
|
53
|
+
/** Flip the sign on every unit. */
|
|
54
|
+
negate(): Duration;
|
|
55
|
+
/**
|
|
56
|
+
* Normalize clock units — cascade overflows upward so that e.g. 90 seconds
|
|
57
|
+
* becomes 1 minute 30 seconds. Calendar units (years, months) are left
|
|
58
|
+
* untouched because normalizing months→years requires knowing *which* year.
|
|
59
|
+
*
|
|
60
|
+
* Weeks are not cascaded into months — they stay as weeks unless the source
|
|
61
|
+
* explicitly had weeks. This matches Luxon's behavior.
|
|
62
|
+
*/
|
|
63
|
+
normalize(): Duration;
|
|
64
|
+
/**
|
|
65
|
+
* Re-project this duration into the given units. Uses approximate
|
|
66
|
+
* conversions for calendar units (365.25d/year, 30d/month). The result
|
|
67
|
+
* is expressed only in the requested units; all others are zero.
|
|
68
|
+
*
|
|
69
|
+
* Duration.fromObject({ hours: 25 }).shiftTo('days', 'hours')
|
|
70
|
+
* // → { days: 1, hours: 1 }
|
|
71
|
+
*/
|
|
72
|
+
shiftTo(...units: DurationUnit[]): Duration;
|
|
73
|
+
/**
|
|
74
|
+
* Express the total duration in a single unit (approximate for calendar
|
|
75
|
+
* units — same caveat as `shiftTo`).
|
|
76
|
+
*/
|
|
77
|
+
as(unit: DurationUnit): number;
|
|
78
|
+
/**
|
|
79
|
+
* ISO 8601 duration string (`P1Y2M3DT4H5M6S`). Always round-trips through
|
|
80
|
+
* {@link fromISO}.
|
|
81
|
+
*
|
|
82
|
+
* Two spec constraints are honoured: the week form (`PnW`) cannot mix with
|
|
83
|
+
* other designators — so weeks are emitted alone as `PnW`, otherwise folded
|
|
84
|
+
* into days; and durations are non-negative — a uniformly-negative duration
|
|
85
|
+
* (e.g. from {@link negate}) is emitted with a single leading `-` over
|
|
86
|
+
* absolute components, which `fromISO` parses back.
|
|
87
|
+
*/
|
|
88
|
+
toISO(): string;
|
|
89
|
+
/**
|
|
90
|
+
* Simple pattern format: `hh:mm:ss`, `HH:mm`, etc. Supported tokens:
|
|
91
|
+
* `Y` (years), `M` (months), `d` (days), `h`/`hh` (hours), `m`/`mm`
|
|
92
|
+
* (minutes), `s`/`ss` (seconds), `S`/`SSS` (milliseconds).
|
|
93
|
+
*
|
|
94
|
+
* Wrap literal text in square brackets so its letters aren't read as tokens:
|
|
95
|
+
* `"h [hours], m [min]"` → `"2 hours, 30 min"`. A single left-to-right scan
|
|
96
|
+
* (longest token first) means substituted values are never re-scanned and
|
|
97
|
+
* literal/overlapping text is left intact.
|
|
98
|
+
*/
|
|
99
|
+
toFormat(pattern: string): string;
|
|
100
|
+
/**
|
|
101
|
+
* Human-readable form: "2 hours, 15 minutes". Uses English hardcoded —
|
|
102
|
+
* locale-aware formatting will go through Rosetta once Story 36.12 lands.
|
|
103
|
+
*/
|
|
104
|
+
toHuman(): string;
|
|
105
|
+
toString(): string;
|
|
106
|
+
toJSON(): string;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=Duration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Duration.d.ts","sourceRoot":"","sources":["../src/Duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,cAAc;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,cAAc,CAAC;AA4BhD,qBAAa,QAAQ;;IAGpB,OAAO;IAeP,gDAAgD;IAChD,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,cAAc,GAAG,QAAQ;IAIhD,+EAA+E;IAC/E,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE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|
4
|
+
* Represents a length of time as a bag of calendar + clock units. Closely
|
|
5
|
+
* mirrors Luxon's `Duration` API so developers coming from AdonisJS feel at
|
|
6
|
+
* home. Pure TypeScript — no Rust/NAPI dependency (durations are lightweight
|
|
7
|
+
* arithmetic on small integers, not worth an FFI crossing).
|
|
8
|
+
*
|
|
9
|
+
* @implements Story 36.8
|
|
10
|
+
*/
|
|
11
|
+
const ORDERED_UNITS = [
|
|
12
|
+
"years",
|
|
13
|
+
"months",
|
|
14
|
+
"weeks",
|
|
15
|
+
"days",
|
|
16
|
+
"hours",
|
|
17
|
+
"minutes",
|
|
18
|
+
"seconds",
|
|
19
|
+
"milliseconds",
|
|
20
|
+
];
|
|
21
|
+
/** Millisecond equivalents for clock units. Calendar units (years/months) are
|
|
22
|
+
* not convertible to a fixed ms count — they depend on the anchor date. When
|
|
23
|
+
* converting, we use an approximation (30-day month, 365-day year) and
|
|
24
|
+
* document it. Luxon does the same. */
|
|
25
|
+
const MS_PER = {
|
|
26
|
+
years: 365.25 * 24 * 60 * 60 * 1000,
|
|
27
|
+
months: 30 * 24 * 60 * 60 * 1000,
|
|
28
|
+
weeks: 7 * 24 * 60 * 60 * 1000,
|
|
29
|
+
days: 24 * 60 * 60 * 1000,
|
|
30
|
+
hours: 60 * 60 * 1000,
|
|
31
|
+
minutes: 60 * 1000,
|
|
32
|
+
seconds: 1000,
|
|
33
|
+
milliseconds: 1,
|
|
34
|
+
};
|
|
35
|
+
export class Duration {
|
|
36
|
+
#values;
|
|
37
|
+
constructor(values) {
|
|
38
|
+
this.#values = {
|
|
39
|
+
years: values.years ?? 0,
|
|
40
|
+
months: values.months ?? 0,
|
|
41
|
+
weeks: values.weeks ?? 0,
|
|
42
|
+
days: values.days ?? 0,
|
|
43
|
+
hours: values.hours ?? 0,
|
|
44
|
+
minutes: values.minutes ?? 0,
|
|
45
|
+
seconds: values.seconds ?? 0,
|
|
46
|
+
milliseconds: values.milliseconds ?? 0,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
// ─── Factories ──────────────────────────────────────────
|
|
50
|
+
/** Build from a plain object of unit values. */
|
|
51
|
+
static fromObject(obj) {
|
|
52
|
+
return new Duration(obj);
|
|
53
|
+
}
|
|
54
|
+
/** Build from a total number of milliseconds (approximates calendar units). */
|
|
55
|
+
static fromMillis(ms) {
|
|
56
|
+
return new Duration({ milliseconds: ms });
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Parse an ISO 8601 duration string (`P1Y2M3DT4H5M6.789S`).
|
|
60
|
+
*
|
|
61
|
+
* Supports the full `PnYnMnDTnHnMnS` form. Fractional seconds are
|
|
62
|
+
* rounded to the nearest millisecond. Weeks (`PnW`) are a separate form
|
|
63
|
+
* that cannot be mixed with other designators per the spec.
|
|
64
|
+
*/
|
|
65
|
+
static fromISO(iso) {
|
|
66
|
+
const trimmed = iso.trim();
|
|
67
|
+
// A leading '-' marks a negative duration (the extension toISO emits).
|
|
68
|
+
const negative = trimmed.startsWith("-P");
|
|
69
|
+
const s = negative ? trimmed.slice(1) : trimmed;
|
|
70
|
+
if (!s.startsWith("P"))
|
|
71
|
+
throw new Error(`Invalid ISO 8601 duration: ${iso}`);
|
|
72
|
+
const apply = (d) => (negative ? d.negate() : d);
|
|
73
|
+
// Week form: P3W
|
|
74
|
+
const weekMatch = /^P(\d+(?:\.\d+)?)W$/.exec(s);
|
|
75
|
+
if (weekMatch) {
|
|
76
|
+
return apply(new Duration({ weeks: Number.parseFloat(weekMatch[1]) }));
|
|
77
|
+
}
|
|
78
|
+
const match = /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:([\d.]+)S)?)?$/.exec(s);
|
|
79
|
+
if (!match)
|
|
80
|
+
throw new Error(`Invalid ISO 8601 duration: ${iso}`);
|
|
81
|
+
const [, y, mo, d, h, mi, sec] = match;
|
|
82
|
+
// The all-optional regex also matches bare "P"/"PT" — a duration needs at
|
|
83
|
+
// least one component. An explicit zero ("PT0S", "P0D") still parses.
|
|
84
|
+
if (!y && !mo && !d && !h && !mi && !sec) {
|
|
85
|
+
throw new Error(`Invalid ISO 8601 duration: ${iso}`);
|
|
86
|
+
}
|
|
87
|
+
const seconds = sec ? Math.floor(Number.parseFloat(sec)) : 0;
|
|
88
|
+
const milliseconds = sec
|
|
89
|
+
? Math.round((Number.parseFloat(sec) - seconds) * 1000)
|
|
90
|
+
: 0;
|
|
91
|
+
return apply(new Duration({
|
|
92
|
+
years: y ? Number(y) : 0,
|
|
93
|
+
months: mo ? Number(mo) : 0,
|
|
94
|
+
days: d ? Number(d) : 0,
|
|
95
|
+
hours: h ? Number(h) : 0,
|
|
96
|
+
minutes: mi ? Number(mi) : 0,
|
|
97
|
+
seconds,
|
|
98
|
+
milliseconds,
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
// ─── Accessors ──────────────────────────────────────────
|
|
102
|
+
get years() {
|
|
103
|
+
return this.#values.years;
|
|
104
|
+
}
|
|
105
|
+
get months() {
|
|
106
|
+
return this.#values.months;
|
|
107
|
+
}
|
|
108
|
+
get weeks() {
|
|
109
|
+
return this.#values.weeks;
|
|
110
|
+
}
|
|
111
|
+
get days() {
|
|
112
|
+
return this.#values.days;
|
|
113
|
+
}
|
|
114
|
+
get hours() {
|
|
115
|
+
return this.#values.hours;
|
|
116
|
+
}
|
|
117
|
+
get minutes() {
|
|
118
|
+
return this.#values.minutes;
|
|
119
|
+
}
|
|
120
|
+
get seconds() {
|
|
121
|
+
return this.#values.seconds;
|
|
122
|
+
}
|
|
123
|
+
get milliseconds() {
|
|
124
|
+
return this.#values.milliseconds;
|
|
125
|
+
}
|
|
126
|
+
/** Get a specific unit. */
|
|
127
|
+
get(unit) {
|
|
128
|
+
return this.#values[unit];
|
|
129
|
+
}
|
|
130
|
+
/** Return the internal bag as a plain object. */
|
|
131
|
+
toObject() {
|
|
132
|
+
return { ...this.#values };
|
|
133
|
+
}
|
|
134
|
+
// ─── Arithmetic ─────────────────────────────────────────
|
|
135
|
+
/** Add another duration to this one (per-unit addition). */
|
|
136
|
+
plus(other) {
|
|
137
|
+
const o = other instanceof Duration ? other.#values : other;
|
|
138
|
+
return new Duration({
|
|
139
|
+
years: this.#values.years + (o.years ?? 0),
|
|
140
|
+
months: this.#values.months + (o.months ?? 0),
|
|
141
|
+
weeks: this.#values.weeks + (o.weeks ?? 0),
|
|
142
|
+
days: this.#values.days + (o.days ?? 0),
|
|
143
|
+
hours: this.#values.hours + (o.hours ?? 0),
|
|
144
|
+
minutes: this.#values.minutes + (o.minutes ?? 0),
|
|
145
|
+
seconds: this.#values.seconds + (o.seconds ?? 0),
|
|
146
|
+
milliseconds: this.#values.milliseconds + (o.milliseconds ?? 0),
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/** Subtract another duration from this one. */
|
|
150
|
+
minus(other) {
|
|
151
|
+
const o = other instanceof Duration ? other.#values : other;
|
|
152
|
+
return new Duration({
|
|
153
|
+
years: this.#values.years - (o.years ?? 0),
|
|
154
|
+
months: this.#values.months - (o.months ?? 0),
|
|
155
|
+
weeks: this.#values.weeks - (o.weeks ?? 0),
|
|
156
|
+
days: this.#values.days - (o.days ?? 0),
|
|
157
|
+
hours: this.#values.hours - (o.hours ?? 0),
|
|
158
|
+
minutes: this.#values.minutes - (o.minutes ?? 0),
|
|
159
|
+
seconds: this.#values.seconds - (o.seconds ?? 0),
|
|
160
|
+
milliseconds: this.#values.milliseconds - (o.milliseconds ?? 0),
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/** Flip the sign on every unit. */
|
|
164
|
+
negate() {
|
|
165
|
+
return new Duration({
|
|
166
|
+
years: -this.#values.years,
|
|
167
|
+
months: -this.#values.months,
|
|
168
|
+
weeks: -this.#values.weeks,
|
|
169
|
+
days: -this.#values.days,
|
|
170
|
+
hours: -this.#values.hours,
|
|
171
|
+
minutes: -this.#values.minutes,
|
|
172
|
+
seconds: -this.#values.seconds,
|
|
173
|
+
milliseconds: -this.#values.milliseconds,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
// ─── Conversion ─────────────────────────────────────────
|
|
177
|
+
/**
|
|
178
|
+
* Normalize clock units — cascade overflows upward so that e.g. 90 seconds
|
|
179
|
+
* becomes 1 minute 30 seconds. Calendar units (years, months) are left
|
|
180
|
+
* untouched because normalizing months→years requires knowing *which* year.
|
|
181
|
+
*
|
|
182
|
+
* Weeks are not cascaded into months — they stay as weeks unless the source
|
|
183
|
+
* explicitly had weeks. This matches Luxon's behavior.
|
|
184
|
+
*/
|
|
185
|
+
normalize() {
|
|
186
|
+
let ms = this.#values.milliseconds;
|
|
187
|
+
let sec = this.#values.seconds;
|
|
188
|
+
let min = this.#values.minutes;
|
|
189
|
+
let hrs = this.#values.hours;
|
|
190
|
+
let days = this.#values.days;
|
|
191
|
+
// Use a carry function that handles negative values correctly.
|
|
192
|
+
// JS `%` is remainder (preserves sign), not modulo. For negative
|
|
193
|
+
// durations we need true modulo so the remainder is always non-negative
|
|
194
|
+
// relative to its parent unit, matching the mathematical convention.
|
|
195
|
+
const carry = (value, divisor) => {
|
|
196
|
+
const quot = Math.trunc(value / divisor);
|
|
197
|
+
const rem = value - quot * divisor;
|
|
198
|
+
return [quot, rem];
|
|
199
|
+
};
|
|
200
|
+
let c;
|
|
201
|
+
[c, ms] = carry(ms, 1000);
|
|
202
|
+
sec += c;
|
|
203
|
+
[c, sec] = carry(sec, 60);
|
|
204
|
+
min += c;
|
|
205
|
+
[c, min] = carry(min, 60);
|
|
206
|
+
hrs += c;
|
|
207
|
+
[c, hrs] = carry(hrs, 24);
|
|
208
|
+
days += c;
|
|
209
|
+
return new Duration({
|
|
210
|
+
years: this.#values.years,
|
|
211
|
+
months: this.#values.months,
|
|
212
|
+
weeks: this.#values.weeks,
|
|
213
|
+
days,
|
|
214
|
+
hours: hrs,
|
|
215
|
+
minutes: min,
|
|
216
|
+
seconds: sec,
|
|
217
|
+
milliseconds: ms,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Re-project this duration into the given units. Uses approximate
|
|
222
|
+
* conversions for calendar units (365.25d/year, 30d/month). The result
|
|
223
|
+
* is expressed only in the requested units; all others are zero.
|
|
224
|
+
*
|
|
225
|
+
* Duration.fromObject({ hours: 25 }).shiftTo('days', 'hours')
|
|
226
|
+
* // → { days: 1, hours: 1 }
|
|
227
|
+
*/
|
|
228
|
+
shiftTo(...units) {
|
|
229
|
+
if (units.length === 0)
|
|
230
|
+
return this;
|
|
231
|
+
// Convert the entire duration to approximate milliseconds, then greedily
|
|
232
|
+
// distribute into the requested units from largest to smallest.
|
|
233
|
+
let totalMs = 0;
|
|
234
|
+
for (const unit of ORDERED_UNITS) {
|
|
235
|
+
totalMs += this.#values[unit] * MS_PER[unit];
|
|
236
|
+
}
|
|
237
|
+
const sorted = [...units].sort((a, b) => ORDERED_UNITS.indexOf(a) - ORDERED_UNITS.indexOf(b));
|
|
238
|
+
const result = {};
|
|
239
|
+
for (const unit of sorted) {
|
|
240
|
+
const value = Math.trunc(totalMs / MS_PER[unit]);
|
|
241
|
+
totalMs -= value * MS_PER[unit];
|
|
242
|
+
result[unit] = value;
|
|
243
|
+
}
|
|
244
|
+
// Any leftover ms goes into the smallest requested unit as a fractional part.
|
|
245
|
+
if (totalMs !== 0 && sorted.length > 0) {
|
|
246
|
+
const smallest = sorted[sorted.length - 1];
|
|
247
|
+
result[smallest] = (result[smallest] ?? 0) + totalMs / MS_PER[smallest];
|
|
248
|
+
}
|
|
249
|
+
return new Duration(result);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Express the total duration in a single unit (approximate for calendar
|
|
253
|
+
* units — same caveat as `shiftTo`).
|
|
254
|
+
*/
|
|
255
|
+
as(unit) {
|
|
256
|
+
let totalMs = 0;
|
|
257
|
+
for (const u of ORDERED_UNITS) {
|
|
258
|
+
totalMs += this.#values[u] * MS_PER[u];
|
|
259
|
+
}
|
|
260
|
+
return totalMs / MS_PER[unit];
|
|
261
|
+
}
|
|
262
|
+
// ─── Formatting ─────────────────────────────────────────
|
|
263
|
+
/**
|
|
264
|
+
* ISO 8601 duration string (`P1Y2M3DT4H5M6S`). Always round-trips through
|
|
265
|
+
* {@link fromISO}.
|
|
266
|
+
*
|
|
267
|
+
* Two spec constraints are honoured: the week form (`PnW`) cannot mix with
|
|
268
|
+
* other designators — so weeks are emitted alone as `PnW`, otherwise folded
|
|
269
|
+
* into days; and durations are non-negative — a uniformly-negative duration
|
|
270
|
+
* (e.g. from {@link negate}) is emitted with a single leading `-` over
|
|
271
|
+
* absolute components, which `fromISO` parses back.
|
|
272
|
+
*/
|
|
273
|
+
toISO() {
|
|
274
|
+
const v = this.#values;
|
|
275
|
+
const units = ORDERED_UNITS.map((u) => v[u]);
|
|
276
|
+
const negative = units.some((n) => n < 0) && units.every((n) => n <= 0);
|
|
277
|
+
const sign = negative ? "-" : "";
|
|
278
|
+
const a = (n) => (negative ? Math.abs(n) : n);
|
|
279
|
+
// Week form only when weeks is the sole unit; never combined with others.
|
|
280
|
+
const onlyWeeks = v.weeks !== 0 &&
|
|
281
|
+
v.years === 0 &&
|
|
282
|
+
v.months === 0 &&
|
|
283
|
+
v.days === 0 &&
|
|
284
|
+
v.hours === 0 &&
|
|
285
|
+
v.minutes === 0 &&
|
|
286
|
+
v.seconds === 0 &&
|
|
287
|
+
v.milliseconds === 0;
|
|
288
|
+
if (onlyWeeks)
|
|
289
|
+
return `${sign}P${a(v.weeks)}W`;
|
|
290
|
+
const days = v.days + v.weeks * 7;
|
|
291
|
+
let date = "";
|
|
292
|
+
if (v.years)
|
|
293
|
+
date += `${a(v.years)}Y`;
|
|
294
|
+
if (v.months)
|
|
295
|
+
date += `${a(v.months)}M`;
|
|
296
|
+
if (days)
|
|
297
|
+
date += `${a(days)}D`;
|
|
298
|
+
let time = "";
|
|
299
|
+
if (v.hours)
|
|
300
|
+
time += `${a(v.hours)}H`;
|
|
301
|
+
if (v.minutes)
|
|
302
|
+
time += `${a(v.minutes)}M`;
|
|
303
|
+
const totalSec = v.seconds + v.milliseconds / 1000;
|
|
304
|
+
if (totalSec)
|
|
305
|
+
time += `${a(totalSec)}S`;
|
|
306
|
+
if (!date && !time)
|
|
307
|
+
return "PT0S";
|
|
308
|
+
return `${sign}P${date}${time ? `T${time}` : ""}`;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Simple pattern format: `hh:mm:ss`, `HH:mm`, etc. Supported tokens:
|
|
312
|
+
* `Y` (years), `M` (months), `d` (days), `h`/`hh` (hours), `m`/`mm`
|
|
313
|
+
* (minutes), `s`/`ss` (seconds), `S`/`SSS` (milliseconds).
|
|
314
|
+
*
|
|
315
|
+
* Wrap literal text in square brackets so its letters aren't read as tokens:
|
|
316
|
+
* `"h [hours], m [min]"` → `"2 hours, 30 min"`. A single left-to-right scan
|
|
317
|
+
* (longest token first) means substituted values are never re-scanned and
|
|
318
|
+
* literal/overlapping text is left intact.
|
|
319
|
+
*/
|
|
320
|
+
toFormat(pattern) {
|
|
321
|
+
const v = this.normalize().#values;
|
|
322
|
+
const tokens = {
|
|
323
|
+
SSS: String(v.milliseconds).padStart(3, "0"),
|
|
324
|
+
hh: String(v.hours).padStart(2, "0"),
|
|
325
|
+
mm: String(v.minutes).padStart(2, "0"),
|
|
326
|
+
ss: String(v.seconds).padStart(2, "0"),
|
|
327
|
+
S: String(v.milliseconds),
|
|
328
|
+
h: String(v.hours),
|
|
329
|
+
m: String(v.minutes),
|
|
330
|
+
s: String(v.seconds),
|
|
331
|
+
Y: String(v.years),
|
|
332
|
+
M: String(v.months),
|
|
333
|
+
d: String(v.days),
|
|
334
|
+
};
|
|
335
|
+
const order = ["SSS", "hh", "mm", "ss", "S", "h", "m", "s", "Y", "M", "d"];
|
|
336
|
+
let out = "";
|
|
337
|
+
let i = 0;
|
|
338
|
+
while (i < pattern.length) {
|
|
339
|
+
if (pattern[i] === "[") {
|
|
340
|
+
i++;
|
|
341
|
+
while (i < pattern.length && pattern[i] !== "]") {
|
|
342
|
+
out += pattern[i];
|
|
343
|
+
i++;
|
|
344
|
+
}
|
|
345
|
+
if (i < pattern.length)
|
|
346
|
+
i++; // skip the closing ']'
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
let matched = false;
|
|
350
|
+
for (const key of order) {
|
|
351
|
+
if (pattern.startsWith(key, i)) {
|
|
352
|
+
out += tokens[key];
|
|
353
|
+
i += key.length;
|
|
354
|
+
matched = true;
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (!matched) {
|
|
359
|
+
out += pattern[i];
|
|
360
|
+
i++;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return out;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Human-readable form: "2 hours, 15 minutes". Uses English hardcoded —
|
|
367
|
+
* locale-aware formatting will go through Rosetta once Story 36.12 lands.
|
|
368
|
+
*/
|
|
369
|
+
toHuman() {
|
|
370
|
+
const v = this.normalize().#values;
|
|
371
|
+
const parts = [];
|
|
372
|
+
if (v.years)
|
|
373
|
+
parts.push(`${v.years} ${v.years === 1 ? "year" : "years"}`);
|
|
374
|
+
if (v.months)
|
|
375
|
+
parts.push(`${v.months} ${v.months === 1 ? "month" : "months"}`);
|
|
376
|
+
if (v.weeks)
|
|
377
|
+
parts.push(`${v.weeks} ${v.weeks === 1 ? "week" : "weeks"}`);
|
|
378
|
+
if (v.days)
|
|
379
|
+
parts.push(`${v.days} ${v.days === 1 ? "day" : "days"}`);
|
|
380
|
+
if (v.hours)
|
|
381
|
+
parts.push(`${v.hours} ${v.hours === 1 ? "hour" : "hours"}`);
|
|
382
|
+
if (v.minutes)
|
|
383
|
+
parts.push(`${v.minutes} ${v.minutes === 1 ? "minute" : "minutes"}`);
|
|
384
|
+
if (v.seconds)
|
|
385
|
+
parts.push(`${v.seconds} ${v.seconds === 1 ? "second" : "seconds"}`);
|
|
386
|
+
if (v.milliseconds)
|
|
387
|
+
parts.push(`${v.milliseconds} ${v.milliseconds === 1 ? "millisecond" : "milliseconds"}`);
|
|
388
|
+
return parts.length > 0 ? parts.join(", ") : "0 seconds";
|
|
389
|
+
}
|
|
390
|
+
toString() {
|
|
391
|
+
return this.toISO();
|
|
392
|
+
}
|
|
393
|
+
toJSON() {
|
|
394
|
+
return this.toISO();
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
//# sourceMappingURL=Duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Duration.js","sourceRoot":"","sources":["../src/Duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAeH,MAAM,aAAa,GAAmB;IACrC,OAAO;IACP,QAAQ;IACR,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,SAAS;IACT,cAAc;CACd,CAAC;AAEF;;;wCAGwC;AACxC,MAAM,MAAM,GAAiC;IAC5C,KAAK,EAAE,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IACnC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAChC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAC9B,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IACzB,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;IACrB,OAAO,EAAE,EAAE,GAAG,IAAI;IAClB,OAAO,EAAE,IAAI;IACb,YAAY,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,OAAO,QAAQ;IACX,OAAO,CAAqC;IAErD,YAAoB,MAAsB;QACzC,IAAI,CAAC,OAAO,GAAG;YACd,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;YACxB,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC;YAC1B,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;YACxB,IAAI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AAC,cAAc,EAAE,CAC5E,CAAC;QACH,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;IAC1D,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IACD,MAAM;QACL,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interval — immutable half-open `[start, end)` time range.
|
|
3
|
+
*
|
|
4
|
+
* Provides set-style operations (`contains`, `overlaps`, `union`,
|
|
5
|
+
* `intersection`, `splitBy`, `splitAt`) that the standalone range helpers
|
|
6
|
+
* in `DateTime.ts` could not express cleanly as methods.
|
|
7
|
+
*
|
|
8
|
+
* @implements Story 36.9
|
|
9
|
+
*/
|
|
10
|
+
import { type DateInput, DateTime, type DateUnit } from "./DateTime.js";
|
|
11
|
+
import { Duration, type DurationUnit } from "./Duration.js";
|
|
12
|
+
export declare class Interval {
|
|
13
|
+
#private;
|
|
14
|
+
private constructor();
|
|
15
|
+
/** Build from two `DateInput` values. Half-open: `[start, end)`. */
|
|
16
|
+
static fromDateTimes(start: DateInput, end: DateInput): Interval;
|
|
17
|
+
/** Build from a start + duration forward. */
|
|
18
|
+
static after(start: DateInput, duration: Duration | {
|
|
19
|
+
amount: number;
|
|
20
|
+
unit: DateUnit;
|
|
21
|
+
}): Interval;
|
|
22
|
+
get start(): DateTime;
|
|
23
|
+
get end(): DateTime;
|
|
24
|
+
/** Length in the given unit (approximate for calendar units). */
|
|
25
|
+
length(unit?: DurationUnit): number;
|
|
26
|
+
/** Duration object between start and end. */
|
|
27
|
+
toDuration(): Duration;
|
|
28
|
+
/** Does this interval contain the given instant? Half-open: `[start, end)`. */
|
|
29
|
+
contains(dt: DateInput): boolean;
|
|
30
|
+
/** Is the given instant strictly before this interval? */
|
|
31
|
+
isBefore(dt: DateInput): boolean;
|
|
32
|
+
/** Is the given instant strictly after this interval? */
|
|
33
|
+
isAfter(dt: DateInput): boolean;
|
|
34
|
+
/** Is this interval empty (zero length)? */
|
|
35
|
+
isEmpty(): boolean;
|
|
36
|
+
/** Do the two intervals share any time? */
|
|
37
|
+
overlaps(other: Interval): boolean;
|
|
38
|
+
/** Does this interval fully enclose `other`? */
|
|
39
|
+
engulfs(other: Interval): boolean;
|
|
40
|
+
/** Does `other`'s start touch this interval's end (no overlap, no gap)? */
|
|
41
|
+
abutsStart(other: Interval): boolean;
|
|
42
|
+
/** Does `other`'s end touch this interval's start? */
|
|
43
|
+
abutsEnd(other: Interval): boolean;
|
|
44
|
+
/** The overlapping sub-interval, or `null` if disjoint. */
|
|
45
|
+
intersection(other: Interval): Interval | null;
|
|
46
|
+
/** The smallest interval that covers both, or `null` if they don't overlap or abut. */
|
|
47
|
+
union(other: Interval): Interval | null;
|
|
48
|
+
/** Split this interval into N sub-intervals of roughly equal `duration` length. */
|
|
49
|
+
splitBy(duration: Duration | {
|
|
50
|
+
amount: number;
|
|
51
|
+
unit: DateUnit;
|
|
52
|
+
}): Interval[];
|
|
53
|
+
/** Split at specific instants. Instants outside the interval are ignored. */
|
|
54
|
+
splitAt(...dts: DateInput[]): Interval[];
|
|
55
|
+
toString(): string;
|
|
56
|
+
toJSON(): {
|
|
57
|
+
start: string;
|
|
58
|
+
end: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=Interval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Interval.d.ts","sourceRoot":"","sources":["../src/Interval.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,KAAK,SAAS,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe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