ts-time-utils 3.0.4 → 4.1.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 (86) hide show
  1. package/README.md +186 -6
  2. package/dist/calculate.d.ts +25 -0
  3. package/dist/calculate.d.ts.map +1 -1
  4. package/dist/calculate.js +125 -0
  5. package/dist/calendar.d.ts +45 -0
  6. package/dist/calendar.d.ts.map +1 -1
  7. package/dist/calendar.js +68 -0
  8. package/dist/calendars.d.ts +156 -0
  9. package/dist/calendars.d.ts.map +1 -0
  10. package/dist/calendars.js +348 -0
  11. package/dist/compare.d.ts +27 -0
  12. package/dist/compare.d.ts.map +1 -1
  13. package/dist/compare.js +46 -0
  14. package/dist/esm/calculate.d.ts +25 -0
  15. package/dist/esm/calculate.d.ts.map +1 -1
  16. package/dist/esm/calculate.js +125 -0
  17. package/dist/esm/calendar.d.ts +45 -0
  18. package/dist/esm/calendar.d.ts.map +1 -1
  19. package/dist/esm/calendar.js +68 -0
  20. package/dist/esm/calendars.d.ts +156 -0
  21. package/dist/esm/calendars.d.ts.map +1 -0
  22. package/dist/esm/calendars.js +348 -0
  23. package/dist/esm/compare.d.ts +27 -0
  24. package/dist/esm/compare.d.ts.map +1 -1
  25. package/dist/esm/compare.js +46 -0
  26. package/dist/esm/finance.d.ts +236 -0
  27. package/dist/esm/finance.d.ts.map +1 -0
  28. package/dist/esm/finance.js +495 -0
  29. package/dist/esm/healthcare.d.ts +260 -0
  30. package/dist/esm/healthcare.d.ts.map +1 -0
  31. package/dist/esm/healthcare.js +447 -0
  32. package/dist/esm/holidays.d.ts +11 -1
  33. package/dist/esm/holidays.d.ts.map +1 -1
  34. package/dist/esm/holidays.js +220 -1
  35. package/dist/esm/index.d.ts +19 -7
  36. package/dist/esm/index.d.ts.map +1 -1
  37. package/dist/esm/index.js +23 -9
  38. package/dist/esm/iterate.d.ts +55 -0
  39. package/dist/esm/iterate.d.ts.map +1 -1
  40. package/dist/esm/iterate.js +86 -0
  41. package/dist/esm/locale.d.ts +53 -0
  42. package/dist/esm/locale.d.ts.map +1 -1
  43. package/dist/esm/locale.js +141 -0
  44. package/dist/esm/precision.d.ts +225 -0
  45. package/dist/esm/precision.d.ts.map +1 -0
  46. package/dist/esm/precision.js +491 -0
  47. package/dist/esm/scheduling.d.ts +206 -0
  48. package/dist/esm/scheduling.d.ts.map +1 -0
  49. package/dist/esm/scheduling.js +329 -0
  50. package/dist/esm/temporal.d.ts +237 -0
  51. package/dist/esm/temporal.d.ts.map +1 -0
  52. package/dist/esm/temporal.js +660 -0
  53. package/dist/esm/validate.d.ts +30 -0
  54. package/dist/esm/validate.d.ts.map +1 -1
  55. package/dist/esm/validate.js +48 -0
  56. package/dist/finance.d.ts +236 -0
  57. package/dist/finance.d.ts.map +1 -0
  58. package/dist/finance.js +495 -0
  59. package/dist/healthcare.d.ts +260 -0
  60. package/dist/healthcare.d.ts.map +1 -0
  61. package/dist/healthcare.js +447 -0
  62. package/dist/holidays.d.ts +11 -1
  63. package/dist/holidays.d.ts.map +1 -1
  64. package/dist/holidays.js +220 -1
  65. package/dist/index.d.ts +19 -7
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +23 -9
  68. package/dist/iterate.d.ts +55 -0
  69. package/dist/iterate.d.ts.map +1 -1
  70. package/dist/iterate.js +86 -0
  71. package/dist/locale.d.ts +53 -0
  72. package/dist/locale.d.ts.map +1 -1
  73. package/dist/locale.js +141 -0
  74. package/dist/precision.d.ts +225 -0
  75. package/dist/precision.d.ts.map +1 -0
  76. package/dist/precision.js +491 -0
  77. package/dist/scheduling.d.ts +206 -0
  78. package/dist/scheduling.d.ts.map +1 -0
  79. package/dist/scheduling.js +329 -0
  80. package/dist/temporal.d.ts +237 -0
  81. package/dist/temporal.d.ts.map +1 -0
  82. package/dist/temporal.js +660 -0
  83. package/dist/validate.d.ts +30 -0
  84. package/dist/validate.d.ts.map +1 -1
  85. package/dist/validate.js +48 -0
  86. package/package.json +31 -1
@@ -0,0 +1,348 @@
1
+ /**
2
+ * @fileoverview Non-Gregorian calendar conversions using Intl.DateTimeFormat
3
+ * Supports Hebrew, Islamic, Buddhist, Japanese, Persian, and Chinese calendars
4
+ */
5
+ /**
6
+ * Extracts calendar date parts using Intl.DateTimeFormat
7
+ */
8
+ function extractCalendarParts(date, calendar) {
9
+ // First get numeric values where possible
10
+ const numericFormatter = new Intl.DateTimeFormat('en-u-ca-' + calendar + '-nu-latn', {
11
+ year: 'numeric',
12
+ month: 'numeric',
13
+ day: 'numeric',
14
+ });
15
+ const eraFormatter = new Intl.DateTimeFormat('en-u-ca-' + calendar, {
16
+ era: 'short',
17
+ });
18
+ const numericParts = numericFormatter.formatToParts(date);
19
+ const eraParts = eraFormatter.formatToParts(date);
20
+ const result = {
21
+ year: 0,
22
+ month: 0,
23
+ day: 0,
24
+ calendar,
25
+ };
26
+ for (const part of numericParts) {
27
+ switch (part.type) {
28
+ case 'year': {
29
+ // Parse year, handling relatedYear for Chinese calendar
30
+ const parsed = parseInt(part.value, 10);
31
+ result.year = isNaN(parsed) ? 0 : parsed;
32
+ break;
33
+ }
34
+ case 'month': {
35
+ // Some calendars return month names instead of numbers
36
+ const parsed = parseInt(part.value, 10);
37
+ if (!isNaN(parsed)) {
38
+ result.month = parsed;
39
+ }
40
+ else {
41
+ // For calendars that return month names, get month index
42
+ result.month = getMonthIndexFromName(part.value, calendar) || 0;
43
+ }
44
+ break;
45
+ }
46
+ case 'day':
47
+ result.day = parseInt(part.value, 10);
48
+ break;
49
+ }
50
+ }
51
+ // Get era separately
52
+ for (const part of eraParts) {
53
+ if (part.type === 'era') {
54
+ result.era = part.value;
55
+ }
56
+ }
57
+ // Special handling for Chinese calendar year (uses related gregorian year)
58
+ if (calendar === 'chinese' && result.year === 0) {
59
+ const relatedFormatter = new Intl.DateTimeFormat('en-u-ca-chinese', {
60
+ year: 'numeric',
61
+ });
62
+ const relatedParts = relatedFormatter.formatToParts(date);
63
+ for (const part of relatedParts) {
64
+ if (part.type === 'relatedYear') {
65
+ result.year = parseInt(part.value, 10);
66
+ }
67
+ }
68
+ }
69
+ return result;
70
+ }
71
+ /**
72
+ * Maps month name to month number for non-numeric month calendars
73
+ */
74
+ function getMonthIndexFromName(monthName, calendar) {
75
+ const hebrewMonths = {
76
+ 'Tishri': 1, 'Tishrei': 1,
77
+ 'Heshvan': 2, 'Cheshvan': 2, 'Marcheshvan': 2,
78
+ 'Kislev': 3,
79
+ 'Tevet': 4, 'Teves': 4,
80
+ 'Shevat': 5, 'Shvat': 5,
81
+ 'Adar': 6, 'Adar I': 6,
82
+ 'Adar II': 7, 'Adar Sheni': 7,
83
+ 'Nisan': 8, 'Nissan': 8,
84
+ 'Iyar': 9, 'Iyyar': 9,
85
+ 'Sivan': 10, 'Siwan': 10,
86
+ 'Tammuz': 11, 'Tamuz': 11,
87
+ 'Av': 12, 'Menachem Av': 12,
88
+ 'Elul': 13,
89
+ };
90
+ if (calendar === 'hebrew') {
91
+ return hebrewMonths[monthName] || 0;
92
+ }
93
+ return 0;
94
+ }
95
+ /**
96
+ * Convert Gregorian date to Hebrew calendar
97
+ * @example toHebrewDate(new Date('2024-03-25')) // { year: 5784, month: 6, day: 15, calendar: 'hebrew' }
98
+ */
99
+ export function toHebrewDate(date) {
100
+ return extractCalendarParts(date, 'hebrew');
101
+ }
102
+ /**
103
+ * Convert Gregorian date to Islamic calendar (default: islamic-umalqura)
104
+ * @param date - Date to convert
105
+ * @param variant - Islamic calendar variant: 'islamic', 'islamic-umalqura', 'islamic-civil'
106
+ * @example toIslamicDate(new Date('2024-03-25')) // { year: 1445, month: 9, day: 15, calendar: 'islamic-umalqura' }
107
+ */
108
+ export function toIslamicDate(date, variant = 'islamic-umalqura') {
109
+ return extractCalendarParts(date, variant);
110
+ }
111
+ /**
112
+ * Convert Gregorian date to Buddhist calendar (Thai Solar)
113
+ * Buddhist Era = Gregorian Year + 543
114
+ * @example toBuddhistDate(new Date('2024-03-25')) // { year: 2567, month: 3, day: 25, calendar: 'buddhist' }
115
+ */
116
+ export function toBuddhistDate(date) {
117
+ return extractCalendarParts(date, 'buddhist');
118
+ }
119
+ /**
120
+ * Convert Gregorian date to Japanese calendar with era
121
+ * @example toJapaneseDate(new Date('2024-03-25')) // { year: 6, month: 3, day: 25, era: 'Reiwa', calendar: 'japanese' }
122
+ */
123
+ export function toJapaneseDate(date) {
124
+ const result = extractCalendarParts(date, 'japanese');
125
+ // Get full era name
126
+ const eraFormatter = new Intl.DateTimeFormat('en-u-ca-japanese', { era: 'long' });
127
+ const eraParts = eraFormatter.formatToParts(date);
128
+ const eraPart = eraParts.find(p => p.type === 'era');
129
+ if (eraPart) {
130
+ result.era = eraPart.value;
131
+ }
132
+ return result;
133
+ }
134
+ /**
135
+ * Convert Gregorian date to Persian (Jalali/Solar Hijri) calendar
136
+ * @example toPersianDate(new Date('2024-03-20')) // { year: 1403, month: 1, day: 1, calendar: 'persian' }
137
+ */
138
+ export function toPersianDate(date) {
139
+ return extractCalendarParts(date, 'persian');
140
+ }
141
+ /**
142
+ * Convert Gregorian date to Chinese lunar calendar
143
+ * @example toChineseDate(new Date('2024-02-10')) // { year: 4721, month: 1, day: 1, calendar: 'chinese' }
144
+ */
145
+ export function toChineseDate(date) {
146
+ return extractCalendarParts(date, 'chinese');
147
+ }
148
+ /**
149
+ * Format date in specified calendar system
150
+ * @param date - Date to format
151
+ * @param calendar - Calendar system to use
152
+ * @param locale - Locale for formatting (default: 'en')
153
+ * @param options - Additional Intl.DateTimeFormat options
154
+ */
155
+ export function formatInCalendar(date, calendar, locale = 'en', options = {}) {
156
+ const localeWithCalendar = `${locale}-u-ca-${calendar}`;
157
+ const formatter = new Intl.DateTimeFormat(localeWithCalendar, {
158
+ dateStyle: 'long',
159
+ ...options,
160
+ });
161
+ return formatter.format(date);
162
+ }
163
+ /**
164
+ * Get month names for a specific calendar system
165
+ * @param calendar - Calendar system
166
+ * @param locale - Locale for month names (default: 'en')
167
+ * @param format - Month name format: 'long', 'short', 'narrow'
168
+ */
169
+ export function getCalendarMonthNames(calendar, locale = 'en', format = 'long') {
170
+ const localeWithCalendar = `${locale}-u-ca-${calendar}`;
171
+ const formatter = new Intl.DateTimeFormat(localeWithCalendar, { month: format });
172
+ // Generate month names by iterating through a reference year
173
+ const months = [];
174
+ const year = 2024;
175
+ // Most calendars have 12 months, Hebrew has 13 in leap years
176
+ const maxMonths = calendar === 'hebrew' ? 13 : 12;
177
+ for (let month = 0; month < maxMonths; month++) {
178
+ try {
179
+ const date = new Date(year, month, 15);
180
+ months.push(formatter.format(date));
181
+ }
182
+ catch {
183
+ break;
184
+ }
185
+ }
186
+ return months;
187
+ }
188
+ /**
189
+ * Get era name for Japanese calendar
190
+ * @param date - Date to get era for
191
+ * @param format - Era format: 'long', 'short', 'narrow'
192
+ */
193
+ export function getJapaneseEra(date, format = 'long') {
194
+ const formatter = new Intl.DateTimeFormat('en-u-ca-japanese', { era: format });
195
+ const parts = formatter.formatToParts(date);
196
+ const eraPart = parts.find(p => p.type === 'era');
197
+ return eraPart?.value || '';
198
+ }
199
+ /**
200
+ * Get all Japanese era names with their start dates
201
+ */
202
+ export function getJapaneseEras() {
203
+ return [
204
+ { name: 'Meiji', start: new Date(1868, 9, 23) },
205
+ { name: 'Taisho', start: new Date(1912, 6, 30) },
206
+ { name: 'Showa', start: new Date(1926, 11, 25) },
207
+ { name: 'Heisei', start: new Date(1989, 0, 8) },
208
+ { name: 'Reiwa', start: new Date(2019, 4, 1) },
209
+ ];
210
+ }
211
+ /**
212
+ * Check if a Hebrew year is a leap year (has 13 months)
213
+ * @param hebrewYear - Year in Hebrew calendar
214
+ */
215
+ export function isHebrewLeapYear(hebrewYear) {
216
+ // Hebrew leap years follow a 19-year cycle
217
+ // Years 3, 6, 8, 11, 14, 17, 19 are leap years
218
+ const position = hebrewYear % 19;
219
+ return [3, 6, 8, 11, 14, 17, 0].includes(position); // 0 = 19th year
220
+ }
221
+ /**
222
+ * Get Hebrew month name
223
+ * @param month - Month number (1-13)
224
+ * @param isLeapYear - Whether the year is a leap year
225
+ */
226
+ export function getHebrewMonthName(month, isLeapYear = false) {
227
+ const months = [
228
+ 'Nisan', 'Iyar', 'Sivan', 'Tammuz', 'Av', 'Elul',
229
+ 'Tishrei', 'Cheshvan', 'Kislev', 'Tevet', 'Shevat',
230
+ isLeapYear ? 'Adar I' : 'Adar',
231
+ 'Adar II'
232
+ ];
233
+ return months[month - 1] || '';
234
+ }
235
+ /**
236
+ * Get Islamic month name
237
+ * @param month - Month number (1-12)
238
+ */
239
+ export function getIslamicMonthName(month) {
240
+ const months = [
241
+ 'Muharram', 'Safar', 'Rabi\' al-Awwal', 'Rabi\' al-Thani',
242
+ 'Jumada al-Awwal', 'Jumada al-Thani', 'Rajab', 'Sha\'ban',
243
+ 'Ramadan', 'Shawwal', 'Dhu al-Qi\'dah', 'Dhu al-Hijjah'
244
+ ];
245
+ return months[month - 1] || '';
246
+ }
247
+ /**
248
+ * Get Persian month name
249
+ * @param month - Month number (1-12)
250
+ */
251
+ export function getPersianMonthName(month) {
252
+ const months = [
253
+ 'Farvardin', 'Ordibehesht', 'Khordad', 'Tir', 'Mordad', 'Shahrivar',
254
+ 'Mehr', 'Aban', 'Azar', 'Dey', 'Bahman', 'Esfand'
255
+ ];
256
+ return months[month - 1] || '';
257
+ }
258
+ /**
259
+ * Check if a Persian year is a leap year
260
+ * Uses the 2820-year cycle algorithm
261
+ */
262
+ export function isPersianLeapYear(persianYear) {
263
+ // Simplified 33-year cycle approximation
264
+ const remainder = persianYear % 33;
265
+ return [1, 5, 9, 13, 17, 22, 26, 30].includes(remainder);
266
+ }
267
+ /**
268
+ * Get Chinese zodiac animal for a year
269
+ * @param gregorianYear - Gregorian year
270
+ */
271
+ export function getChineseZodiac(gregorianYear) {
272
+ const animals = [
273
+ 'Rat', 'Ox', 'Tiger', 'Rabbit', 'Dragon', 'Snake',
274
+ 'Horse', 'Goat', 'Monkey', 'Rooster', 'Dog', 'Pig'
275
+ ];
276
+ // 1900 was Year of the Rat
277
+ const index = (gregorianYear - 1900) % 12;
278
+ return animals[index >= 0 ? index : index + 12];
279
+ }
280
+ /**
281
+ * Get Chinese element for a year
282
+ * @param gregorianYear - Gregorian year
283
+ */
284
+ export function getChineseElement(gregorianYear) {
285
+ const elements = ['Metal', 'Water', 'Wood', 'Fire', 'Earth'];
286
+ // Each element covers 2 years
287
+ const index = Math.floor(((gregorianYear - 1900) % 10) / 2);
288
+ return elements[index >= 0 ? index : index + 5];
289
+ }
290
+ /**
291
+ * Get full Chinese zodiac description (element + animal)
292
+ * @param gregorianYear - Gregorian year
293
+ */
294
+ export function getChineseZodiacFull(gregorianYear) {
295
+ return `${getChineseElement(gregorianYear)} ${getChineseZodiac(gregorianYear)}`;
296
+ }
297
+ /**
298
+ * Convert calendar date to string representation
299
+ */
300
+ export function calendarDateToString(calendarDate) {
301
+ const { year, month, day, era, calendar } = calendarDate;
302
+ const eraStr = era ? ` ${era}` : '';
303
+ return `${year}/${month}/${day}${eraStr} (${calendar})`;
304
+ }
305
+ /**
306
+ * Compare two calendar dates
307
+ * @returns negative if a < b, 0 if equal, positive if a > b
308
+ */
309
+ export function compareCalendarDates(a, b) {
310
+ if (a.calendar !== b.calendar) {
311
+ throw new Error('Cannot compare dates from different calendar systems');
312
+ }
313
+ if (a.year !== b.year)
314
+ return a.year - b.year;
315
+ if (a.month !== b.month)
316
+ return a.month - b.month;
317
+ return a.day - b.day;
318
+ }
319
+ /**
320
+ * Get current date in specified calendar
321
+ */
322
+ export function today(calendar) {
323
+ return extractCalendarParts(new Date(), calendar);
324
+ }
325
+ /**
326
+ * Check if two calendar dates are the same day
327
+ */
328
+ export function isSameCalendarDay(a, b) {
329
+ return a.calendar === b.calendar &&
330
+ a.year === b.year &&
331
+ a.month === b.month &&
332
+ a.day === b.day;
333
+ }
334
+ /**
335
+ * Get supported calendar systems
336
+ */
337
+ export function getSupportedCalendars() {
338
+ return [
339
+ 'hebrew',
340
+ 'islamic',
341
+ 'islamic-umalqura',
342
+ 'islamic-civil',
343
+ 'buddhist',
344
+ 'japanese',
345
+ 'persian',
346
+ 'chinese'
347
+ ];
348
+ }
@@ -214,4 +214,31 @@ export declare function partitionDates(dates: Date[], predicate: (date: Date) =>
214
214
  * nthDate(dates, 2) // third earliest
215
215
  */
216
216
  export declare function nthDate(dates: Date[], n: number): Date | undefined;
217
+ /**
218
+ * Find the index of the closest date to a target in an array
219
+ * @param dates - Array of candidate dates
220
+ * @param target - The target date
221
+ * @returns Index of the closest date, or -1 if array is empty
222
+ * @example
223
+ * closestIndexTo([date1, date2, date3], targetDate) // 1
224
+ */
225
+ export declare function closestIndexTo(dates: Date[], target: Date): number;
226
+ /**
227
+ * Get the number of overlapping days between two date ranges
228
+ * @param range1 - First range { start, end }
229
+ * @param range2 - Second range { start, end }
230
+ * @returns Number of overlapping days (0 if no overlap)
231
+ * @example
232
+ * getOverlappingDaysInIntervals(
233
+ * { start: new Date('2024-01-01'), end: new Date('2024-01-10') },
234
+ * { start: new Date('2024-01-05'), end: new Date('2024-01-15') }
235
+ * ) // 6 (Jan 5-10 inclusive)
236
+ */
237
+ export declare function getOverlappingDaysInIntervals(range1: {
238
+ start: Date;
239
+ end: Date;
240
+ }, range2: {
241
+ start: Date;
242
+ end: Date;
243
+ }): number;
217
244
  //# sourceMappingURL=compare.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../src/compare.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAEzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,IAAI,EAAE,EACb,SAAS,GAAE,KAAK,GAAG,MAAc,GAChC,IAAI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AalB;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAQlE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,CAgBlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,EAClC,MAAM,EAAE;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,GACjC,MAAM,CAaR"}
@@ -415,3 +415,49 @@ export function nthDate(dates, n) {
415
415
  return undefined;
416
416
  return sorted[index];
417
417
  }
418
+ /**
419
+ * Find the index of the closest date to a target in an array
420
+ * @param dates - Array of candidate dates
421
+ * @param target - The target date
422
+ * @returns Index of the closest date, or -1 if array is empty
423
+ * @example
424
+ * closestIndexTo([date1, date2, date3], targetDate) // 1
425
+ */
426
+ export function closestIndexTo(dates, target) {
427
+ if (dates.length === 0)
428
+ return -1;
429
+ const targetTime = target.getTime();
430
+ let closestIndex = 0;
431
+ let minDiff = Math.abs(dates[0].getTime() - targetTime);
432
+ for (let i = 1; i < dates.length; i++) {
433
+ const diff = Math.abs(dates[i].getTime() - targetTime);
434
+ if (diff < minDiff) {
435
+ minDiff = diff;
436
+ closestIndex = i;
437
+ }
438
+ }
439
+ return closestIndex;
440
+ }
441
+ /**
442
+ * Get the number of overlapping days between two date ranges
443
+ * @param range1 - First range { start, end }
444
+ * @param range2 - Second range { start, end }
445
+ * @returns Number of overlapping days (0 if no overlap)
446
+ * @example
447
+ * getOverlappingDaysInIntervals(
448
+ * { start: new Date('2024-01-01'), end: new Date('2024-01-10') },
449
+ * { start: new Date('2024-01-05'), end: new Date('2024-01-15') }
450
+ * ) // 6 (Jan 5-10 inclusive)
451
+ */
452
+ export function getOverlappingDaysInIntervals(range1, range2) {
453
+ const start1 = new Date(range1.start.getFullYear(), range1.start.getMonth(), range1.start.getDate());
454
+ const end1 = new Date(range1.end.getFullYear(), range1.end.getMonth(), range1.end.getDate());
455
+ const start2 = new Date(range2.start.getFullYear(), range2.start.getMonth(), range2.start.getDate());
456
+ const end2 = new Date(range2.end.getFullYear(), range2.end.getMonth(), range2.end.getDate());
457
+ const overlapStart = start1 > start2 ? start1 : start2;
458
+ const overlapEnd = end1 < end2 ? end1 : end2;
459
+ if (overlapStart > overlapEnd)
460
+ return 0;
461
+ const diffMs = overlapEnd.getTime() - overlapStart.getTime();
462
+ return Math.floor(diffMs / 86400000) + 1;
463
+ }
@@ -0,0 +1,236 @@
1
+ /**
2
+ * @fileoverview Finance utilities for market-aware date calculations
3
+ * Provides US market hours, trading days, settlement dates, and options expiration
4
+ */
5
+ import type { DateInput } from './types.js';
6
+ /** Supported US stock markets */
7
+ export type USMarket = 'NYSE' | 'NASDAQ';
8
+ /** Market trading hours configuration */
9
+ export interface MarketHours {
10
+ /** Regular market open time */
11
+ open: {
12
+ hour: number;
13
+ minute: number;
14
+ };
15
+ /** Regular market close time */
16
+ close: {
17
+ hour: number;
18
+ minute: number;
19
+ };
20
+ /** Market timezone */
21
+ timezone: string;
22
+ /** Pre-market open time (optional) */
23
+ preMarket?: {
24
+ hour: number;
25
+ minute: number;
26
+ };
27
+ /** After-hours close time (optional) */
28
+ afterHours?: {
29
+ hour: number;
30
+ minute: number;
31
+ };
32
+ }
33
+ /** Options expiration type */
34
+ export type OptionsExpirationType = 'monthly' | 'weekly' | 'quarterly';
35
+ /** Market hours for US exchanges */
36
+ export declare const MARKET_HOURS: Record<USMarket, MarketHours>;
37
+ /** US market holidays (NYSE/NASDAQ follow same schedule) */
38
+ export declare const US_MARKET_HOLIDAYS: readonly ["New Year's Day", "Martin Luther King Jr. Day", "Presidents' Day", "Good Friday", "Memorial Day", "Juneteenth", "Independence Day", "Labor Day", "Thanksgiving Day", "Christmas Day"];
39
+ /**
40
+ * Check if a date is a US market holiday
41
+ * @param date - Date to check
42
+ * @param market - Market (default: NYSE)
43
+ * @returns True if the date is a market holiday
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * isMarketHoliday(new Date('2024-12-25')); // true (Christmas)
48
+ * isMarketHoliday(new Date('2024-01-02')); // false
49
+ * ```
50
+ */
51
+ export declare function isMarketHoliday(date: DateInput, market?: USMarket): boolean;
52
+ /**
53
+ * Check if a date is a trading day (weekday and not a market holiday)
54
+ * @param date - Date to check
55
+ * @param market - Market (default: NYSE)
56
+ * @returns True if the date is a trading day
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * isTradingDay(new Date('2024-01-15')); // true (Monday)
61
+ * isTradingDay(new Date('2024-01-13')); // false (Saturday)
62
+ * ```
63
+ */
64
+ export declare function isTradingDay(date: DateInput, market?: USMarket): boolean;
65
+ /**
66
+ * Check if the market is currently open
67
+ * @param date - Date/time to check
68
+ * @param market - Market (default: NYSE)
69
+ * @returns True if market is open at the specified time
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * // Check if NYSE is open now
74
+ * isMarketOpen(new Date(), 'NYSE');
75
+ *
76
+ * // Check specific time
77
+ * isMarketOpen(new Date('2024-01-15T10:30:00-05:00')); // true
78
+ * ```
79
+ */
80
+ export declare function isMarketOpen(date: DateInput, market?: USMarket): boolean;
81
+ /**
82
+ * Get market hours configuration
83
+ * @param market - Market (default: NYSE)
84
+ * @returns Market hours configuration (deep copy)
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const hours = getMarketHours('NASDAQ');
89
+ * console.log(hours.open); // { hour: 9, minute: 30 }
90
+ * ```
91
+ */
92
+ export declare function getMarketHours(market?: USMarket): MarketHours;
93
+ /**
94
+ * Get market open time for a specific date
95
+ * @param date - Date to get market open for
96
+ * @param market - Market (default: NYSE)
97
+ * @returns Date set to market open time
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const open = getMarketOpen(new Date('2024-01-15'));
102
+ * console.log(open); // 2024-01-15T09:30:00
103
+ * ```
104
+ */
105
+ export declare function getMarketOpen(date: DateInput, market?: USMarket): Date;
106
+ /**
107
+ * Get market close time for a specific date
108
+ * @param date - Date to get market close for
109
+ * @param market - Market (default: NYSE)
110
+ * @returns Date set to market close time
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * const close = getMarketClose(new Date('2024-01-15'));
115
+ * console.log(close); // 2024-01-15T16:00:00
116
+ * ```
117
+ */
118
+ export declare function getMarketClose(date: DateInput, market?: USMarket): Date;
119
+ /**
120
+ * Get next market open time after a given date
121
+ * @param after - Start searching after this date
122
+ * @param market - Market (default: NYSE)
123
+ * @returns Next market open date/time
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * // If it's Friday evening, returns Monday 9:30 AM
128
+ * const nextOpen = getNextMarketOpen(new Date('2024-01-12T17:00:00'));
129
+ * ```
130
+ */
131
+ export declare function getNextMarketOpen(after: DateInput, market?: USMarket): Date;
132
+ /**
133
+ * Get next market close time after a given date
134
+ * @param after - Start searching after this date
135
+ * @param market - Market (default: NYSE)
136
+ * @returns Next market close date/time
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * const nextClose = getNextMarketClose(new Date('2024-01-15T10:00:00'));
141
+ * // Returns 2024-01-15T16:00:00 (same day close)
142
+ * ```
143
+ */
144
+ export declare function getNextMarketClose(after: DateInput, market?: USMarket): Date;
145
+ /**
146
+ * Calculate settlement date (T+N) from trade date
147
+ * @param tradeDate - Trade date
148
+ * @param days - Number of business days for settlement (e.g., 1 for T+1, 2 for T+2)
149
+ * @param market - Market (default: NYSE)
150
+ * @returns Settlement date
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * // T+2 settlement
155
+ * const settlement = getSettlementDate(new Date('2024-01-15'), 2);
156
+ * // Returns 2024-01-17 (skipping weekends/holidays)
157
+ * ```
158
+ */
159
+ export declare function getSettlementDate(tradeDate: DateInput, days: number, market?: USMarket): Date;
160
+ /**
161
+ * Calculate trade date from settlement date (reverse T+N)
162
+ * @param settlementDate - Settlement date
163
+ * @param days - Number of business days for settlement
164
+ * @param market - Market (default: NYSE)
165
+ * @returns Trade date
166
+ *
167
+ * @example
168
+ * ```ts
169
+ * const tradeDate = getTradeDateFromSettlement(new Date('2024-01-17'), 2);
170
+ * // Returns 2024-01-15
171
+ * ```
172
+ */
173
+ export declare function getTradeDateFromSettlement(settlementDate: DateInput, days: number, market?: USMarket): Date;
174
+ /**
175
+ * Iterate through each trading day in a range
176
+ * @param start - Start date
177
+ * @param end - End date
178
+ * @param market - Market (default: NYSE)
179
+ * @returns Array of trading days
180
+ *
181
+ * @example
182
+ * ```ts
183
+ * const days = eachTradingDay(new Date('2024-01-15'), new Date('2024-01-19'));
184
+ * // Returns Mon, Tue, Wed, Thu, Fri (if no holidays)
185
+ * ```
186
+ */
187
+ export declare function eachTradingDay(start: DateInput, end: DateInput, market?: USMarket): Date[];
188
+ /**
189
+ * Count trading days between two dates
190
+ * @param start - Start date
191
+ * @param end - End date
192
+ * @param market - Market (default: NYSE)
193
+ * @returns Number of trading days
194
+ *
195
+ * @example
196
+ * ```ts
197
+ * const count = countTradingDays(new Date('2024-01-15'), new Date('2024-01-19'));
198
+ * // Returns 5 (Mon-Fri if no holidays)
199
+ * ```
200
+ */
201
+ export declare function countTradingDays(start: DateInput, end: DateInput, market?: USMarket): number;
202
+ /**
203
+ * Add trading days to a date
204
+ * @param date - Start date
205
+ * @param days - Number of trading days to add (can be negative)
206
+ * @param market - Market (default: NYSE)
207
+ * @returns Resulting date
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * const result = addTradingDays(new Date('2024-01-15'), 5);
212
+ * // Returns 5 trading days later
213
+ * ```
214
+ */
215
+ export declare function addTradingDays(date: DateInput, days: number, market?: USMarket): Date;
216
+ /**
217
+ * Get options expiration date
218
+ * @param year - Year
219
+ * @param month - Month (1-12)
220
+ * @param type - Expiration type (default: 'monthly')
221
+ * @returns Options expiration date
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * // Monthly options expire on 3rd Friday
226
+ * const exp = getOptionsExpiration(2024, 1, 'monthly');
227
+ *
228
+ * // Weekly options expire every Friday
229
+ * const weekly = getOptionsExpiration(2024, 1, 'weekly');
230
+ *
231
+ * // Quarterly options expire on 3rd Friday of Mar, Jun, Sep, Dec
232
+ * const quarterly = getOptionsExpiration(2024, 3, 'quarterly');
233
+ * ```
234
+ */
235
+ export declare function getOptionsExpiration(year: number, month: number, type?: OptionsExpirationType): Date;
236
+ //# sourceMappingURL=finance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finance.d.ts","sourceRoot":"","sources":["../../src/finance.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,iCAAiC;AACjC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEzC,yCAAyC;AACzC,MAAM,WAAW,WAAW;IAC1B,+BAA+B;IAC/B,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,gCAAgC;IAChC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,wCAAwC;IACxC,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AAED,8BAA8B;AAC9B,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEvE,oCAAoC;AACpC,eAAO,MAAM,YAAY,EAAE,MAAM,C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