ts-time-utils 1.1.0 → 2.0.0

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.
Files changed (74) hide show
  1. package/README.md +458 -12
  2. package/dist/calculate.d.ts +7 -2
  3. package/dist/calculate.d.ts.map +1 -1
  4. package/dist/calculate.js +13 -3
  5. package/dist/calendar.d.ts +103 -0
  6. package/dist/calendar.d.ts.map +1 -1
  7. package/dist/calendar.js +224 -0
  8. package/dist/compare.d.ts +217 -0
  9. package/dist/compare.d.ts.map +1 -0
  10. package/dist/compare.js +417 -0
  11. package/dist/cron.d.ts +82 -0
  12. package/dist/cron.d.ts.map +1 -0
  13. package/dist/cron.js +294 -0
  14. package/dist/esm/calculate.d.ts +7 -2
  15. package/dist/esm/calculate.d.ts.map +1 -1
  16. package/dist/esm/calculate.js +13 -3
  17. package/dist/esm/calendar.d.ts +103 -0
  18. package/dist/esm/calendar.d.ts.map +1 -1
  19. package/dist/esm/calendar.js +224 -0
  20. package/dist/esm/compare.d.ts +217 -0
  21. package/dist/esm/compare.d.ts.map +1 -0
  22. package/dist/esm/compare.js +417 -0
  23. package/dist/esm/cron.d.ts +82 -0
  24. package/dist/esm/cron.d.ts.map +1 -0
  25. package/dist/esm/cron.js +294 -0
  26. package/dist/esm/fiscal.d.ts +195 -0
  27. package/dist/esm/fiscal.d.ts.map +1 -0
  28. package/dist/esm/fiscal.js +295 -0
  29. package/dist/esm/format.d.ts +65 -0
  30. package/dist/esm/format.d.ts.map +1 -1
  31. package/dist/esm/format.js +202 -0
  32. package/dist/esm/index.d.ts +13 -6
  33. package/dist/esm/index.d.ts.map +1 -1
  34. package/dist/esm/index.js +14 -6
  35. package/dist/esm/iterate.d.ts +212 -0
  36. package/dist/esm/iterate.d.ts.map +1 -0
  37. package/dist/esm/iterate.js +409 -0
  38. package/dist/esm/parse.d.ts +45 -0
  39. package/dist/esm/parse.d.ts.map +1 -1
  40. package/dist/esm/parse.js +207 -0
  41. package/dist/esm/timezone.d.ts +52 -0
  42. package/dist/esm/timezone.d.ts.map +1 -1
  43. package/dist/esm/timezone.js +171 -0
  44. package/dist/esm/validate.d.ts +51 -0
  45. package/dist/esm/validate.d.ts.map +1 -1
  46. package/dist/esm/validate.js +92 -0
  47. package/dist/esm/workingHours.d.ts +70 -0
  48. package/dist/esm/workingHours.d.ts.map +1 -1
  49. package/dist/esm/workingHours.js +161 -0
  50. package/dist/fiscal.d.ts +195 -0
  51. package/dist/fiscal.d.ts.map +1 -0
  52. package/dist/fiscal.js +295 -0
  53. package/dist/format.d.ts +65 -0
  54. package/dist/format.d.ts.map +1 -1
  55. package/dist/format.js +202 -0
  56. package/dist/index.d.ts +13 -6
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +14 -6
  59. package/dist/iterate.d.ts +212 -0
  60. package/dist/iterate.d.ts.map +1 -0
  61. package/dist/iterate.js +409 -0
  62. package/dist/parse.d.ts +45 -0
  63. package/dist/parse.d.ts.map +1 -1
  64. package/dist/parse.js +207 -0
  65. package/dist/timezone.d.ts +52 -0
  66. package/dist/timezone.d.ts.map +1 -1
  67. package/dist/timezone.js +171 -0
  68. package/dist/validate.d.ts +51 -0
  69. package/dist/validate.d.ts.map +1 -1
  70. package/dist/validate.js +92 -0
  71. package/dist/workingHours.d.ts +70 -0
  72. package/dist/workingHours.d.ts.map +1 -1
  73. package/dist/workingHours.js +161 -0
  74. package/package.json +30 -11
@@ -0,0 +1,295 @@
1
+ /**
2
+ * @fileoverview Fiscal year and accounting period utilities
3
+ * Supports configurable fiscal year start months for business calculations
4
+ */
5
+ const DEFAULT_CONFIG = {
6
+ startMonth: 1, // January (calendar year)
7
+ };
8
+ /**
9
+ * Get the fiscal year for a given date
10
+ * @param date - The date to check
11
+ * @param config - Fiscal year configuration
12
+ * @returns The fiscal year number
13
+ * @example
14
+ * // Calendar year (Jan start)
15
+ * getFiscalYear(new Date('2024-03-15')) // 2024
16
+ *
17
+ * // April fiscal year (UK/India style)
18
+ * getFiscalYear(new Date('2024-03-15'), { startMonth: 4 }) // 2023
19
+ * getFiscalYear(new Date('2024-04-15'), { startMonth: 4 }) // 2024
20
+ *
21
+ * // July fiscal year (Australia style)
22
+ * getFiscalYear(new Date('2024-06-15'), { startMonth: 7 }) // 2023
23
+ * getFiscalYear(new Date('2024-07-15'), { startMonth: 7 }) // 2024
24
+ */
25
+ export function getFiscalYear(date, config = {}) {
26
+ const { startMonth } = { ...DEFAULT_CONFIG, ...config };
27
+ const month = date.getMonth() + 1; // 1-12
28
+ const year = date.getFullYear();
29
+ if (startMonth === 1) {
30
+ return year;
31
+ }
32
+ // Fiscal year is named by when it starts
33
+ // If current month is before fiscal year start, we're still in the fiscal year that started last calendar year
34
+ return month < startMonth ? year - 1 : year;
35
+ }
36
+ /**
37
+ * Get the fiscal quarter for a given date (1-4)
38
+ * @param date - The date to check
39
+ * @param config - Fiscal year configuration
40
+ * @returns The fiscal quarter (1-4)
41
+ * @example
42
+ * // Calendar year quarters
43
+ * getFiscalQuarter(new Date('2024-01-15')) // 1
44
+ * getFiscalQuarter(new Date('2024-04-15')) // 2
45
+ *
46
+ * // April fiscal year
47
+ * getFiscalQuarter(new Date('2024-04-15'), { startMonth: 4 }) // 1
48
+ * getFiscalQuarter(new Date('2024-07-15'), { startMonth: 4 }) // 2
49
+ */
50
+ export function getFiscalQuarter(date, config = {}) {
51
+ const { startMonth } = { ...DEFAULT_CONFIG, ...config };
52
+ const month = date.getMonth() + 1; // 1-12
53
+ // Calculate months since fiscal year start
54
+ let monthsIntoFiscalYear = month - startMonth;
55
+ if (monthsIntoFiscalYear < 0) {
56
+ monthsIntoFiscalYear += 12;
57
+ }
58
+ return Math.floor(monthsIntoFiscalYear / 3) + 1;
59
+ }
60
+ /**
61
+ * Get the start date of a fiscal year
62
+ * @param fiscalYear - The fiscal year
63
+ * @param config - Fiscal year configuration
64
+ * @returns Start date of the fiscal year
65
+ * @example
66
+ * getFiscalYearStart(2024) // 2024-01-01
67
+ * getFiscalYearStart(2024, { startMonth: 4 }) // 2024-04-01 (FY2024 starts Apr 2024)
68
+ * getFiscalYearStart(2024, { startMonth: 7 }) // 2024-07-01 (FY2024 starts Jul 2024)
69
+ */
70
+ export function getFiscalYearStart(fiscalYear, config = {}) {
71
+ const { startMonth } = { ...DEFAULT_CONFIG, ...config };
72
+ // Fiscal year N starts in the startMonth of calendar year N
73
+ return new Date(fiscalYear, startMonth - 1, 1);
74
+ }
75
+ /**
76
+ * Get the end date of a fiscal year
77
+ * @param fiscalYear - The fiscal year
78
+ * @param config - Fiscal year configuration
79
+ * @returns End date of the fiscal year (last day, 23:59:59.999)
80
+ * @example
81
+ * getFiscalYearEnd(2024) // 2024-12-31
82
+ * getFiscalYearEnd(2024, { startMonth: 4 }) // 2025-03-31 (FY2024 ends Mar 2025)
83
+ * getFiscalYearEnd(2024, { startMonth: 7 }) // 2025-06-30 (FY2024 ends Jun 2025)
84
+ */
85
+ export function getFiscalYearEnd(fiscalYear, config = {}) {
86
+ const { startMonth } = { ...DEFAULT_CONFIG, ...config };
87
+ if (startMonth === 1) {
88
+ return new Date(fiscalYear, 11, 31, 23, 59, 59, 999);
89
+ }
90
+ // FY ends the day before the next FY starts
91
+ // FY N ends in (startMonth - 1) of year (N + 1)
92
+ const endMonth = startMonth - 1; // Month before start month (0-indexed: 0=Jan...11=Dec)
93
+ const endYear = fiscalYear + 1;
94
+ // Get last day of the end month
95
+ const lastDay = new Date(endYear, endMonth, 0).getDate();
96
+ return new Date(endYear, endMonth - 1, lastDay, 23, 59, 59, 999);
97
+ }
98
+ /**
99
+ * Get the start date of a fiscal quarter
100
+ * @param fiscalYear - The fiscal year
101
+ * @param quarter - The quarter (1-4)
102
+ * @param config - Fiscal year configuration
103
+ * @returns Start date of the fiscal quarter
104
+ * @example
105
+ * getFiscalQuarterStart(2024, 1) // 2024-01-01
106
+ * getFiscalQuarterStart(2024, 2) // 2024-04-01
107
+ * getFiscalQuarterStart(2024, 1, { startMonth: 4 }) // 2023-04-01
108
+ * getFiscalQuarterStart(2024, 2, { startMonth: 4 }) // 2023-07-01
109
+ */
110
+ export function getFiscalQuarterStart(fiscalYear, quarter, config = {}) {
111
+ if (quarter < 1 || quarter > 4) {
112
+ throw new Error('Quarter must be between 1 and 4');
113
+ }
114
+ const { startMonth } = { ...DEFAULT_CONFIG, ...config };
115
+ const fyStart = getFiscalYearStart(fiscalYear, config);
116
+ // Add (quarter - 1) * 3 months to fiscal year start
117
+ const monthsToAdd = (quarter - 1) * 3;
118
+ const resultMonth = fyStart.getMonth() + monthsToAdd;
119
+ return new Date(fyStart.getFullYear(), resultMonth, 1);
120
+ }
121
+ /**
122
+ * Get the end date of a fiscal quarter
123
+ * @param fiscalYear - The fiscal year
124
+ * @param quarter - The quarter (1-4)
125
+ * @param config - Fiscal year configuration
126
+ * @returns End date of the fiscal quarter (last day, 23:59:59.999)
127
+ * @example
128
+ * getFiscalQuarterEnd(2024, 1) // 2024-03-31
129
+ * getFiscalQuarterEnd(2024, 2) // 2024-06-30
130
+ * getFiscalQuarterEnd(2024, 1, { startMonth: 4 }) // 2023-06-30
131
+ */
132
+ export function getFiscalQuarterEnd(fiscalYear, quarter, config = {}) {
133
+ if (quarter < 1 || quarter > 4) {
134
+ throw new Error('Quarter must be between 1 and 4');
135
+ }
136
+ const quarterStart = getFiscalQuarterStart(fiscalYear, quarter, config);
137
+ // End of quarter is last day of the third month
138
+ const endMonth = quarterStart.getMonth() + 3;
139
+ const lastDay = new Date(quarterStart.getFullYear(), endMonth, 0).getDate();
140
+ return new Date(quarterStart.getFullYear(), endMonth - 1, lastDay, 23, 59, 59, 999);
141
+ }
142
+ /**
143
+ * Check if two dates are in the same fiscal year
144
+ * @param date1 - First date
145
+ * @param date2 - Second date
146
+ * @param config - Fiscal year configuration
147
+ * @returns True if both dates are in the same fiscal year
148
+ */
149
+ export function isSameFiscalYear(date1, date2, config = {}) {
150
+ return getFiscalYear(date1, config) === getFiscalYear(date2, config);
151
+ }
152
+ /**
153
+ * Check if two dates are in the same fiscal quarter
154
+ * @param date1 - First date
155
+ * @param date2 - Second date
156
+ * @param config - Fiscal year configuration
157
+ * @returns True if both dates are in the same fiscal year and quarter
158
+ */
159
+ export function isSameFiscalQuarter(date1, date2, config = {}) {
160
+ return (getFiscalYear(date1, config) === getFiscalYear(date2, config) &&
161
+ getFiscalQuarter(date1, config) === getFiscalQuarter(date2, config));
162
+ }
163
+ /**
164
+ * Get the fiscal month (1-12) within the fiscal year
165
+ * @param date - The date to check
166
+ * @param config - Fiscal year configuration
167
+ * @returns The fiscal month (1-12, where 1 is the first month of fiscal year)
168
+ * @example
169
+ * getFiscalMonth(new Date('2024-01-15')) // 1
170
+ * getFiscalMonth(new Date('2024-04-15'), { startMonth: 4 }) // 1
171
+ * getFiscalMonth(new Date('2024-03-15'), { startMonth: 4 }) // 12
172
+ */
173
+ export function getFiscalMonth(date, config = {}) {
174
+ const { startMonth } = { ...DEFAULT_CONFIG, ...config };
175
+ const month = date.getMonth() + 1; // 1-12
176
+ let fiscalMonth = month - startMonth + 1;
177
+ if (fiscalMonth <= 0) {
178
+ fiscalMonth += 12;
179
+ }
180
+ return fiscalMonth;
181
+ }
182
+ /**
183
+ * Get the number of days remaining in the fiscal year
184
+ * @param date - The date to check
185
+ * @param config - Fiscal year configuration
186
+ * @returns Number of days remaining in the fiscal year
187
+ */
188
+ export function getDaysRemainingInFiscalYear(date, config = {}) {
189
+ const fiscalYear = getFiscalYear(date, config);
190
+ const fyEnd = getFiscalYearEnd(fiscalYear, config);
191
+ const startOfDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());
192
+ const diffMs = fyEnd.getTime() - startOfDay.getTime();
193
+ return Math.ceil(diffMs / (1000 * 60 * 60 * 24));
194
+ }
195
+ /**
196
+ * Get the number of days elapsed in the fiscal year
197
+ * @param date - The date to check
198
+ * @param config - Fiscal year configuration
199
+ * @returns Number of days elapsed in the fiscal year (including the given date)
200
+ */
201
+ export function getDaysElapsedInFiscalYear(date, config = {}) {
202
+ const fiscalYear = getFiscalYear(date, config);
203
+ const fyStart = getFiscalYearStart(fiscalYear, config);
204
+ const startOfDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());
205
+ const diffMs = startOfDay.getTime() - fyStart.getTime();
206
+ return Math.floor(diffMs / (1000 * 60 * 60 * 24)) + 1;
207
+ }
208
+ /**
209
+ * Get fiscal year progress as a percentage
210
+ * @param date - The date to check
211
+ * @param config - Fiscal year configuration
212
+ * @returns Percentage of fiscal year completed (0-100)
213
+ */
214
+ export function getFiscalYearProgress(date, config = {}) {
215
+ const fiscalYear = getFiscalYear(date, config);
216
+ const fyStart = getFiscalYearStart(fiscalYear, config);
217
+ const fyEnd = getFiscalYearEnd(fiscalYear, config);
218
+ const totalDays = Math.ceil((fyEnd.getTime() - fyStart.getTime()) / (1000 * 60 * 60 * 24));
219
+ const elapsed = getDaysElapsedInFiscalYear(date, config);
220
+ return Math.min(100, Math.round((elapsed / totalDays) * 10000) / 100);
221
+ }
222
+ /**
223
+ * Get the fiscal week number (1-53) within the fiscal year
224
+ * @param date - The date to check
225
+ * @param config - Fiscal year configuration
226
+ * @returns The fiscal week number
227
+ */
228
+ export function getFiscalWeek(date, config = {}) {
229
+ const elapsed = getDaysElapsedInFiscalYear(date, config);
230
+ return Math.ceil(elapsed / 7);
231
+ }
232
+ /**
233
+ * Common fiscal year configurations
234
+ */
235
+ export const FISCAL_PRESETS = {
236
+ /** Calendar year (January start) - Default */
237
+ CALENDAR: { startMonth: 1 },
238
+ /** UK/India government fiscal year (April start) */
239
+ UK_INDIA: { startMonth: 4 },
240
+ /** Australian fiscal year (July start) */
241
+ AUSTRALIA: { startMonth: 7 },
242
+ /** US federal government fiscal year (October start) */
243
+ US_FEDERAL: { startMonth: 10 },
244
+ };
245
+ /**
246
+ * Format fiscal year as string (e.g., "FY2024" or "FY2023/24")
247
+ * @param fiscalYear - The fiscal year
248
+ * @param config - Fiscal year configuration
249
+ * @param format - Format style: 'short' (FY2024) or 'long' (FY2023/24)
250
+ * @returns Formatted fiscal year string
251
+ */
252
+ export function formatFiscalYear(fiscalYear, config = {}, format = 'short') {
253
+ const { startMonth } = { ...DEFAULT_CONFIG, ...config };
254
+ if (format === 'short' || startMonth === 1) {
255
+ return `FY${fiscalYear}`;
256
+ }
257
+ // For non-calendar fiscal years, show both years
258
+ const calendarYearStart = fiscalYear - 1;
259
+ const shortEndYear = fiscalYear.toString().slice(-2);
260
+ return `FY${calendarYearStart}/${shortEndYear}`;
261
+ }
262
+ /**
263
+ * Format fiscal quarter as string (e.g., "Q1 FY2024")
264
+ * @param fiscalYear - The fiscal year
265
+ * @param quarter - The quarter (1-4)
266
+ * @param config - Fiscal year configuration
267
+ * @returns Formatted fiscal quarter string
268
+ */
269
+ export function formatFiscalQuarter(fiscalYear, quarter, config = {}) {
270
+ const fyString = formatFiscalYear(fiscalYear, config, 'short');
271
+ return `Q${quarter} ${fyString}`;
272
+ }
273
+ /**
274
+ * Get fiscal period info for a date
275
+ * @param date - The date to analyze
276
+ * @param config - Fiscal year configuration
277
+ * @returns Object with fiscal period information
278
+ */
279
+ export function getFiscalPeriodInfo(date, config = {}) {
280
+ const fiscalYear = getFiscalYear(date, config);
281
+ const fiscalQuarter = getFiscalQuarter(date, config);
282
+ return {
283
+ fiscalYear,
284
+ fiscalQuarter,
285
+ fiscalMonth: getFiscalMonth(date, config),
286
+ fiscalWeek: getFiscalWeek(date, config),
287
+ daysElapsed: getDaysElapsedInFiscalYear(date, config),
288
+ daysRemaining: getDaysRemainingInFiscalYear(date, config),
289
+ progress: getFiscalYearProgress(date, config),
290
+ quarterStart: getFiscalQuarterStart(fiscalYear, fiscalQuarter, config),
291
+ quarterEnd: getFiscalQuarterEnd(fiscalYear, fiscalQuarter, config),
292
+ yearStart: getFiscalYearStart(fiscalYear, config),
293
+ yearEnd: getFiscalYearEnd(fiscalYear, config),
294
+ };
295
+ }
@@ -22,4 +22,69 @@ export declare function formatTime(date: Date, format?: '12h' | '24h' | 'iso'):
22
22
  * @param duration - duration string (e.g., "1h 30m", "2d", "45s")
23
23
  */
24
24
  export declare function parseDuration(duration: string): number;
25
+ /**
26
+ * Format a date using a pattern string
27
+ * @param date - date to format
28
+ * @param pattern - format pattern (e.g., "YYYY-MM-DD", "MMM D, YYYY")
29
+ *
30
+ * Supported tokens:
31
+ * - YYYY: 4-digit year
32
+ * - YY: 2-digit year
33
+ * - MMMM: Full month name (January)
34
+ * - MMM: Short month name (Jan)
35
+ * - MM: Month with leading zero (01-12)
36
+ * - M: Month (1-12)
37
+ * - DDDD: Full day name (Monday)
38
+ * - DDD: Short day name (Mon)
39
+ * - DD: Day with leading zero (01-31)
40
+ * - D: Day (1-31)
41
+ * - HH: Hours 24h with leading zero (00-23)
42
+ * - H: Hours 24h (0-23)
43
+ * - hh: Hours 12h with leading zero (01-12)
44
+ * - h: Hours 12h (1-12)
45
+ * - mm: Minutes with leading zero (00-59)
46
+ * - ss: Seconds with leading zero (00-59)
47
+ * - SSS: Milliseconds (000-999)
48
+ * - A: AM/PM
49
+ * - a: am/pm
50
+ */
51
+ export declare function formatDate(date: Date, pattern: string): string;
52
+ /**
53
+ * Format a relative time string (e.g., "in 2 days", "3 hours ago")
54
+ * @param date - target date
55
+ * @param baseDate - base date (default: now)
56
+ */
57
+ export declare function formatRelativeTime(date: Date, baseDate?: Date): string;
58
+ /**
59
+ * Format a date range (e.g., "Jan 5 - Jan 10, 2025")
60
+ * @param start - start date
61
+ * @param end - end date
62
+ * @param options - formatting options
63
+ */
64
+ export declare function formatDateRange(start: Date, end: Date, options?: {
65
+ separator?: string;
66
+ includeTime?: boolean;
67
+ format?: 'short' | 'medium' | 'long';
68
+ }): string;
69
+ /**
70
+ * Format a number as an ordinal (1st, 2nd, 3rd, etc.)
71
+ * @param n - number to format
72
+ */
73
+ export declare function formatOrdinal(n: number): string;
74
+ /**
75
+ * Format a day of month as an ordinal (1st, 2nd, 3rd, etc.)
76
+ * @param date - date to format
77
+ */
78
+ export declare function formatDayOrdinal(date: Date): string;
79
+ /**
80
+ * Format a duration in a compact form (e.g., "02:30:45")
81
+ * @param ms - milliseconds
82
+ * @param showHours - always show hours even if 0
83
+ */
84
+ export declare function formatDurationCompact(ms: number, showHours?: boolean): string;
85
+ /**
86
+ * Format a date/time for display in a calendar
87
+ * @param date - date to format
88
+ */
89
+ export declare function formatCalendarDate(date: Date): string;
25
90
  //# sourceMappingURL=format.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,aAAa,EACd,MAAM,gBAAgB,CAAC;AAGxB;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CA2E9E;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CA+CvE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,KAAK,GAAG,KAAK,GAAG,KAAa,GAAG,MAAM,CAcpF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAyDtD"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,aAAa,EACd,MAAM,gBAAgB,CAAC;AAGxB;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CA2E9E;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CA+CvE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,KAAK,GAAG,KAAK,GAAG,KAAa,GAAG,MAAM,CAcpF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAyDtD;AAkBD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CA4C9D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,GAAE,IAAiB,GAAG,MAAM,CAuClF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,IAAI,EACT,OAAO,GAAE;IACP,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;CACjC,GACL,MAAM,CA6BR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,OAAc,GAAG,MAAM,CAYnF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAwBrD"}
@@ -187,3 +187,205 @@ export function parseDuration(duration) {
187
187
  }
188
188
  return totalMs;
189
189
  }
190
+ const MONTH_NAMES = [
191
+ 'January', 'February', 'March', 'April', 'May', 'June',
192
+ 'July', 'August', 'September', 'October', 'November', 'December'
193
+ ];
194
+ const MONTH_NAMES_SHORT = [
195
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
196
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
197
+ ];
198
+ const DAY_NAMES = [
199
+ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
200
+ ];
201
+ const DAY_NAMES_SHORT = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
202
+ /**
203
+ * Format a date using a pattern string
204
+ * @param date - date to format
205
+ * @param pattern - format pattern (e.g., "YYYY-MM-DD", "MMM D, YYYY")
206
+ *
207
+ * Supported tokens:
208
+ * - YYYY: 4-digit year
209
+ * - YY: 2-digit year
210
+ * - MMMM: Full month name (January)
211
+ * - MMM: Short month name (Jan)
212
+ * - MM: Month with leading zero (01-12)
213
+ * - M: Month (1-12)
214
+ * - DDDD: Full day name (Monday)
215
+ * - DDD: Short day name (Mon)
216
+ * - DD: Day with leading zero (01-31)
217
+ * - D: Day (1-31)
218
+ * - HH: Hours 24h with leading zero (00-23)
219
+ * - H: Hours 24h (0-23)
220
+ * - hh: Hours 12h with leading zero (01-12)
221
+ * - h: Hours 12h (1-12)
222
+ * - mm: Minutes with leading zero (00-59)
223
+ * - ss: Seconds with leading zero (00-59)
224
+ * - SSS: Milliseconds (000-999)
225
+ * - A: AM/PM
226
+ * - a: am/pm
227
+ */
228
+ export function formatDate(date, pattern) {
229
+ const year = date.getFullYear();
230
+ const month = date.getMonth();
231
+ const day = date.getDate();
232
+ const dayOfWeek = date.getDay();
233
+ const hours = date.getHours();
234
+ const minutes = date.getMinutes();
235
+ const seconds = date.getSeconds();
236
+ const milliseconds = date.getMilliseconds();
237
+ const hours12 = hours % 12 || 12;
238
+ const ampm = hours < 12 ? 'AM' : 'PM';
239
+ const pad = (n, len = 2) => String(n).padStart(len, '0');
240
+ // Token mapping - order matters for replacements
241
+ const tokens = [
242
+ [/YYYY/g, String(year)],
243
+ [/YY/g, String(year).slice(-2)],
244
+ [/MMMM/g, MONTH_NAMES[month]],
245
+ [/MMM/g, MONTH_NAMES_SHORT[month]],
246
+ [/MM/g, pad(month + 1)],
247
+ [/\bM\b/g, String(month + 1)], // Word boundary to avoid matching M in other tokens
248
+ [/DDDD/g, DAY_NAMES[dayOfWeek]],
249
+ [/DDD/g, DAY_NAMES_SHORT[dayOfWeek]],
250
+ [/DD/g, pad(day)],
251
+ [/\bD\b/g, String(day)],
252
+ [/HH/g, pad(hours)],
253
+ [/\bH\b/g, String(hours)],
254
+ [/hh/g, pad(hours12)],
255
+ [/\bh\b/g, String(hours12)],
256
+ [/mm/g, pad(minutes)],
257
+ [/ss/g, pad(seconds)],
258
+ [/SSS/g, pad(milliseconds, 3)],
259
+ [/\bA\b/g, ampm],
260
+ [/\ba\b/g, ampm.toLowerCase()],
261
+ ];
262
+ let result = pattern;
263
+ for (const [regex, replacement] of tokens) {
264
+ result = result.replace(regex, replacement);
265
+ }
266
+ return result;
267
+ }
268
+ /**
269
+ * Format a relative time string (e.g., "in 2 days", "3 hours ago")
270
+ * @param date - target date
271
+ * @param baseDate - base date (default: now)
272
+ */
273
+ export function formatRelativeTime(date, baseDate = new Date()) {
274
+ const diffMs = date.getTime() - baseDate.getTime();
275
+ const isFuture = diffMs > 0;
276
+ const absDiffMs = Math.abs(diffMs);
277
+ const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' });
278
+ if (absDiffMs < MILLISECONDS_PER_MINUTE) {
279
+ const seconds = Math.round(absDiffMs / MILLISECONDS_PER_SECOND);
280
+ return rtf.format(isFuture ? seconds : -seconds, 'second');
281
+ }
282
+ if (absDiffMs < MILLISECONDS_PER_HOUR) {
283
+ const minutes = Math.round(absDiffMs / MILLISECONDS_PER_MINUTE);
284
+ return rtf.format(isFuture ? minutes : -minutes, 'minute');
285
+ }
286
+ if (absDiffMs < MILLISECONDS_PER_DAY) {
287
+ const hours = Math.round(absDiffMs / MILLISECONDS_PER_HOUR);
288
+ return rtf.format(isFuture ? hours : -hours, 'hour');
289
+ }
290
+ if (absDiffMs < MILLISECONDS_PER_WEEK) {
291
+ const days = Math.round(absDiffMs / MILLISECONDS_PER_DAY);
292
+ return rtf.format(isFuture ? days : -days, 'day');
293
+ }
294
+ if (absDiffMs < MILLISECONDS_PER_MONTH) {
295
+ const weeks = Math.round(absDiffMs / MILLISECONDS_PER_WEEK);
296
+ return rtf.format(isFuture ? weeks : -weeks, 'week');
297
+ }
298
+ if (absDiffMs < MILLISECONDS_PER_YEAR) {
299
+ const months = Math.round(absDiffMs / MILLISECONDS_PER_MONTH);
300
+ return rtf.format(isFuture ? months : -months, 'month');
301
+ }
302
+ const years = Math.round(absDiffMs / MILLISECONDS_PER_YEAR);
303
+ return rtf.format(isFuture ? years : -years, 'year');
304
+ }
305
+ /**
306
+ * Format a date range (e.g., "Jan 5 - Jan 10, 2025")
307
+ * @param start - start date
308
+ * @param end - end date
309
+ * @param options - formatting options
310
+ */
311
+ export function formatDateRange(start, end, options = {}) {
312
+ const { separator = ' - ', includeTime = false, format = 'medium' } = options;
313
+ const sameYear = start.getFullYear() === end.getFullYear();
314
+ const sameMonth = sameYear && start.getMonth() === end.getMonth();
315
+ const sameDay = sameMonth && start.getDate() === end.getDate();
316
+ const formatOptions = {
317
+ month: format === 'short' ? 'short' : format === 'long' ? 'long' : 'short',
318
+ day: 'numeric',
319
+ };
320
+ if (!sameYear || format === 'long') {
321
+ formatOptions.year = 'numeric';
322
+ }
323
+ if (includeTime) {
324
+ formatOptions.hour = 'numeric';
325
+ formatOptions.minute = '2-digit';
326
+ }
327
+ if (sameDay && !includeTime) {
328
+ return start.toLocaleDateString('en-US', { ...formatOptions, year: 'numeric' });
329
+ }
330
+ const startStr = start.toLocaleDateString('en-US', formatOptions);
331
+ const endStr = end.toLocaleDateString('en-US', { ...formatOptions, year: 'numeric' });
332
+ return `${startStr}${separator}${endStr}`;
333
+ }
334
+ /**
335
+ * Format a number as an ordinal (1st, 2nd, 3rd, etc.)
336
+ * @param n - number to format
337
+ */
338
+ export function formatOrdinal(n) {
339
+ const suffixes = ['th', 'st', 'nd', 'rd'];
340
+ const v = n % 100;
341
+ return n + (suffixes[(v - 20) % 10] || suffixes[v] || suffixes[0]);
342
+ }
343
+ /**
344
+ * Format a day of month as an ordinal (1st, 2nd, 3rd, etc.)
345
+ * @param date - date to format
346
+ */
347
+ export function formatDayOrdinal(date) {
348
+ return formatOrdinal(date.getDate());
349
+ }
350
+ /**
351
+ * Format a duration in a compact form (e.g., "02:30:45")
352
+ * @param ms - milliseconds
353
+ * @param showHours - always show hours even if 0
354
+ */
355
+ export function formatDurationCompact(ms, showHours = true) {
356
+ const hours = Math.floor(ms / MILLISECONDS_PER_HOUR);
357
+ const minutes = Math.floor((ms % MILLISECONDS_PER_HOUR) / MILLISECONDS_PER_MINUTE);
358
+ const seconds = Math.floor((ms % MILLISECONDS_PER_MINUTE) / MILLISECONDS_PER_SECOND);
359
+ const pad = (n) => String(n).padStart(2, '0');
360
+ if (showHours || hours > 0) {
361
+ return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
362
+ }
363
+ return `${pad(minutes)}:${pad(seconds)}`;
364
+ }
365
+ /**
366
+ * Format a date/time for display in a calendar
367
+ * @param date - date to format
368
+ */
369
+ export function formatCalendarDate(date) {
370
+ const now = new Date();
371
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
372
+ const dateOnly = new Date(date.getFullYear(), date.getMonth(), date.getDate());
373
+ const diffDays = Math.round((dateOnly.getTime() - today.getTime()) / MILLISECONDS_PER_DAY);
374
+ if (diffDays === 0)
375
+ return 'Today';
376
+ if (diffDays === -1)
377
+ return 'Yesterday';
378
+ if (diffDays === 1)
379
+ return 'Tomorrow';
380
+ if (diffDays > 1 && diffDays < 7) {
381
+ return DAY_NAMES[date.getDay()];
382
+ }
383
+ if (diffDays >= -6 && diffDays < 0) {
384
+ return `Last ${DAY_NAMES[date.getDay()]}`;
385
+ }
386
+ // Same year, show month and day
387
+ if (date.getFullYear() === now.getFullYear()) {
388
+ return formatDate(date, 'MMM D');
389
+ }
390
+ return formatDate(date, 'MMM D, YYYY');
391
+ }
@@ -2,16 +2,17 @@
2
2
  * @fileoverview Main entry point for ts-time-utils library
3
3
  * Re-exports all functions from individual modules for convenience
4
4
  */
5
- export { formatDuration, timeAgo, formatTime, parseDuration } from './format.js';
5
+ export { formatDuration, timeAgo, formatTime, parseDuration, formatDate, formatDateRange, formatOrdinal, formatDayOrdinal, formatDurationCompact, formatCalendarDate } from './format.js';
6
6
  export { differenceInUnits, addTime, subtractTime, startOf, endOf, isBetween, businessDaysBetween } from './calculate.js';
7
- export { isValidDate, isLeapYear, isPast, isFuture, isToday, isYesterday, isTomorrow, isSameDay, isWeekend, isWeekday, isValidTimeString, isValidISOString } from './validate.js';
7
+ export { isValidDate, isLeapYear, isPast, isFuture, isToday, isYesterday, isTomorrow, isSameDay, isSameWeek, isSameMonth, isSameYear, isThisWeek, isThisMonth, isThisYear, isWeekend, isWeekday, isBusinessDay, isInLastNDays, isInNextNDays, isValidTimeString, isValidISOString } from './validate.js';
8
8
  export { calculateAge, getAgeInUnits, getLifeStage, getNextBirthday, getDaysUntilBirthday, isBirthday } from './age.js';
9
- export { getWeekNumber, getWeekOfMonth, getQuarter, getDayOfYear, getWeeksInYear, getDaysInMonth, getDaysInYear, getEaster, getMonthsInYear, getDaysInMonthArray, getWeekdaysInMonth, getFirstDayOfMonth, getLastDayOfMonth, getFirstDayOfYear, getLastDayOfYear } from './calendar.js';
10
- export { parseDate, parseRelativeDate, parseTimeAgo, parseCustomFormat, parseManyFormats } from './parse.js';
9
+ export { getWeekNumber, getWeekOfMonth, getQuarter, getDayOfYear, getWeeksInYear, getDaysInMonth, getDaysInYear, getEaster, getMonthsInYear, getDaysInMonthArray, getWeekdaysInMonth, getFirstDayOfMonth, getLastDayOfMonth, getFirstDayOfYear, getLastDayOfYear, getNthDayOfMonth, getNewYearsDay, getMLKDay, getPresidentsDay, getMemorialDay, getIndependenceDay, getLaborDay, getColumbusDay, getVeteransDay, getThanksgivingDay, getChristmasDay, getGoodFriday, getUSHolidays, isUSHoliday, getUSHolidayName, getStartOfWeek, getEndOfWeek, getWeeksInMonth } from './calendar.js';
10
+ export type { USHoliday } from './calendar.js';
11
+ export { parseDate, parseRelativeDate, parseTimeAgo, parseCustomFormat, parseManyFormats, parseISO8601Duration, parseISO8601DurationToMs, parseTime, guessDateFormat, parseAutoFormat, parseRangeEndpoint } from './parse.js';
11
12
  export { sleep, timeout, debounce, throttle, retry, createStopwatch, measureTime, measureAsync, benchmark, Stopwatch } from './performance.js';
12
13
  export { createInterval, isValidInterval, intervalDuration, intervalContains, intervalsOverlap, intervalIntersection, mergeIntervals, subtractInterval, splitIntervalByDay, totalIntervalCoverage, normalizeIntervals } from './interval.js';
13
- export { getTimezoneOffset, formatInTimeZone, getZonedTime, convertDateToZone, isValidTimeZone, COMMON_TIMEZONES, getLocalOffset, compareZoneOffsets, reinterpretAsZone } from './timezone.js';
14
- export { DEFAULT_WORKING_HOURS, isWorkingDay, isWorkingTime, nextWorkingTime, workingTimeBetween, addWorkingHours } from './workingHours.js';
14
+ export { getTimezoneOffset, formatInTimeZone, getZonedTime, convertDateToZone, isValidTimeZone, COMMON_TIMEZONES, getLocalOffset, compareZoneOffsets, reinterpretAsZone, isDST, getNextDSTTransition, findCommonWorkingHours, getTimezoneAbbreviation, convertBetweenZones, getTimezoneDifferenceHours, isSameTimezone } from './timezone.js';
15
+ export { DEFAULT_WORKING_HOURS, isWorkingDay, isWorkingTime, nextWorkingTime, workingTimeBetween, addWorkingHours, addWorkingDays, subtractWorkingDays, getNextWorkingDay, getPreviousWorkingDay, getWorkingDaysInMonth, getWorkingDaysInMonthArray, workingDaysBetween, isBreakTime, getWorkDayStart, getWorkDayEnd, getWorkingHoursPerDay } from './workingHours.js';
15
16
  export { today, yesterday, tomorrow, lastNDays, nextNDays, thisWeek, lastWeek, nextWeek, thisMonth, lastMonth, nextMonth, thisYear, lastYear, nextYear, rollingWindowDays, quarterRange, lastQuarter, nextQuarter, RANGE_PRESETS } from './rangePresets.js';
16
17
  export { Duration, createDuration, isValidDuration, parseDurationString, formatDurationString, maxDuration, minDuration, sumDurations, averageDuration } from './duration.js';
17
18
  export { serializeDate, deserializeDate, createDateReviver, createDateReplacer, parseISOString, toEpochTimestamp, fromEpochTimestamp, createEpochTimestamp, toDateObject, fromDateObject, isValidISODateString, isValidEpochTimestamp, cloneDate, datesEqual, now, parseJSONWithDates, stringifyWithDates } from './serialize.js';
@@ -22,4 +23,10 @@ export { dateRangeOverlap, hasOverlappingRanges, mergeDateRanges, findGaps, spli
22
23
  export { parseNaturalDate, parseRelativePhrase, extractDatesFromText, suggestDateFromContext, type NaturalParseOptions, type ExtractedDate } from './naturalLanguage.js';
23
24
  export { MILLISECONDS_PER_SECOND, MILLISECONDS_PER_MINUTE, MILLISECONDS_PER_HOUR, MILLISECONDS_PER_DAY, MILLISECONDS_PER_WEEK, MILLISECONDS_PER_MONTH, MILLISECONDS_PER_YEAR, SECONDS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, SECONDS_PER_WEEK, type TimeUnit, type FormatOptions } from './constants.js';
24
25
  export type { DateInput, DateRange, ParseOptions, WorkingHoursConfig, AgeResult, ZonedTime, Interval, BenchmarkResult, RecurrencePattern, RecurrenceRule, RecurrenceFrequency, LocaleFormatOptions, BusinessConfig, DateValidator, DateTransformer, TimeUtilsError, ParseError, ValidationError, DurationUnit, DurationInput, DurationComparison, SerializationOptions, DateObject, EpochTimestamp, SupportedLocale, LocaleConfig, RelativeTimeOptions, RelativeTimeUnit } from './types.js';
26
+ export { parseCronExpression, parseCronField, matchesCron, getNextCronDate, getNextCronDates, getPreviousCronDate, isValidCron, describeCron, CRON_PRESETS } from './cron.js';
27
+ export type { CronParts, ParsedCronField } from './cron.js';
28
+ export { getFiscalYear, getFiscalQuarter, getFiscalYearStart, getFiscalYearEnd, getFiscalQuarterStart, getFiscalQuarterEnd, isSameFiscalYear, isSameFiscalQuarter, getFiscalMonth, getDaysRemainingInFiscalYear, getDaysElapsedInFiscalYear, getFiscalYearProgress, getFiscalWeek, formatFiscalYear, formatFiscalQuarter, getFiscalPeriodInfo, FISCAL_PRESETS } from './fiscal.js';
29
+ export type { FiscalConfig } from './fiscal.js';
30
+ export { compareDates, compareDatesDesc, sortDates, minDate, maxDate, dateExtent, uniqueDates, closestDate, closestFutureDate, closestPastDate, clampDate, isDateInRange, filterDatesInRange, groupDates, groupDatesByYear, groupDatesByMonth, groupDatesByDay, groupDatesByDayOfWeek, medianDate, averageDate, roundDate, snapDate, isChronological, dateSpan, partitionDates, nthDate } from './compare.js';
31
+ export { eachDay, eachWeekday, eachWeekend, eachWeek, eachMonth, eachQuarter, eachYear, eachHour, eachMinute, eachDayOfWeek, eachInterval, countDays, countWeekdays, countWeekendDays, countWeeks, countMonths, iterateDates, iterateDays, iterateWeekdays, iterateMonths, filterDays, eachMonthEnd, eachNthDayOfMonth } from './iterate.js';
25
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACV,aAAa,EACd,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,EACL,SAAS,EACT,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,UAAU,EACX,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,aAAa,EACb,cAAc,EACd,UAAU,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,aAAa,EACb,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB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EACtB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,SAAS,EACT,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,EACV,eAAe,EACf,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACV,aAAa,EACb,UAAU,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,EACL,SAAS,EACT,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACT,aAAa,EACb,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,UAAU,EACX,MAAM,U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