soff-date 0.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.
- package/LICENSE +21 -0
- package/README.md +276 -0
- package/dist/core/algorithms/easter.cjs +2 -0
- package/dist/core/algorithms/easter.cjs.map +1 -0
- package/dist/core/algorithms/easter.d.cts +7 -0
- package/dist/core/algorithms/easter.d.ts +7 -0
- package/dist/core/algorithms/easter.js +2 -0
- package/dist/core/algorithms/easter.js.map +1 -0
- package/dist/core/algorithms/nth-weekday.cjs +2 -0
- package/dist/core/algorithms/nth-weekday.cjs.map +1 -0
- package/dist/core/algorithms/nth-weekday.d.cts +10 -0
- package/dist/core/algorithms/nth-weekday.d.ts +10 -0
- package/dist/core/algorithms/nth-weekday.js +2 -0
- package/dist/core/algorithms/nth-weekday.js.map +1 -0
- package/dist/core/algorithms/shifts.cjs +2 -0
- package/dist/core/algorithms/shifts.cjs.map +1 -0
- package/dist/core/algorithms/shifts.d.cts +12 -0
- package/dist/core/algorithms/shifts.d.ts +12 -0
- package/dist/core/algorithms/shifts.js +2 -0
- package/dist/core/algorithms/shifts.js.map +1 -0
- package/dist/core/engine.cjs +2 -0
- package/dist/core/engine.cjs.map +1 -0
- package/dist/core/engine.d.cts +10 -0
- package/dist/core/engine.d.ts +10 -0
- package/dist/core/engine.js +2 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/types.cjs +2 -0
- package/dist/core/types.cjs.map +1 -0
- package/dist/core/types.d.cts +32 -0
- package/dist/core/types.d.ts +32 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/i18n/en.cjs +2 -0
- package/dist/i18n/en.cjs.map +1 -0
- package/dist/i18n/en.d.cts +5 -0
- package/dist/i18n/en.d.ts +5 -0
- package/dist/i18n/en.js +2 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/es.cjs +2 -0
- package/dist/i18n/es.cjs.map +1 -0
- package/dist/i18n/es.d.cts +5 -0
- package/dist/i18n/es.d.ts +5 -0
- package/dist/i18n/es.js +2 -0
- package/dist/i18n/es.js.map +1 -0
- package/dist/i18n/index.cjs +2 -0
- package/dist/i18n/index.cjs.map +1 -0
- package/dist/i18n/index.d.cts +4 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/pt.cjs +2 -0
- package/dist/i18n/pt.cjs.map +1 -0
- package/dist/i18n/pt.d.cts +5 -0
- package/dist/i18n/pt.d.ts +5 -0
- package/dist/i18n/pt.js +2 -0
- package/dist/i18n/pt.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/locales/co.cjs +2 -0
- package/dist/locales/co.cjs.map +1 -0
- package/dist/locales/co.d.cts +10 -0
- package/dist/locales/co.d.ts +10 -0
- package/dist/locales/co.js +2 -0
- package/dist/locales/co.js.map +1 -0
- package/dist/locales/us.cjs +2 -0
- package/dist/locales/us.cjs.map +1 -0
- package/dist/locales/us.d.cts +10 -0
- package/dist/locales/us.d.ts +10 -0
- package/dist/locales/us.js +2 -0
- package/dist/locales/us.js.map +1 -0
- package/package.json +148 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Luis C. Rojas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# Soff Date
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/soff-date)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://github.com/bledxs/soff-date/actions)
|
|
6
|
+
[](https://codecov.io/gh/bledxs/soff-date)
|
|
7
|
+
[](https://bundlephobia.com/package/soff-date)
|
|
8
|
+
[](#contributors)
|
|
9
|
+
|
|
10
|
+
Lightweight, tree-shakeable holiday calculator with algorithmic date computation.
|
|
11
|
+
|
|
12
|
+
**Zero dependencies** · **TypeScript** · **~3KB per locale**
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Soff Date](#soff-date)
|
|
17
|
+
- [Table of Contents](#table-of-contents)
|
|
18
|
+
- [Why?](#why)
|
|
19
|
+
- [Install](#install)
|
|
20
|
+
- [Quick Start](#quick-start)
|
|
21
|
+
- [i18n Support](#i18n-support)
|
|
22
|
+
- [Available Locales](#available-locales)
|
|
23
|
+
- [Available Languages](#available-languages)
|
|
24
|
+
- [Shift Rules Explained](#shift-rules-explained)
|
|
25
|
+
- [Emiliani (Colombia, Argentina, Chile)](#emiliani-colombia-argentina-chile)
|
|
26
|
+
- [Observed US (USA, UK)](#observed-us-usa-uk)
|
|
27
|
+
- [Advanced: Create Your Own Locale](#advanced-create-your-own-locale)
|
|
28
|
+
- [Advanced: Use Algorithms Directly](#advanced-use-algorithms-directly)
|
|
29
|
+
- [Bundle Size](#bundle-size)
|
|
30
|
+
- [API Reference](#api-reference)
|
|
31
|
+
- [`getHolidays(year, options?)`](#getholidaysyear-options)
|
|
32
|
+
- [`isHoliday(date, options?)`](#isholidaydate-options)
|
|
33
|
+
- [`getNextHoliday(from?, options?)`](#getnextholidayfrom-options)
|
|
34
|
+
- [Types](#types)
|
|
35
|
+
- [Contributing](#contributing)
|
|
36
|
+
- [License](#license)
|
|
37
|
+
- [Documentation](#documentation)
|
|
38
|
+
- [Contributors](#contributors)
|
|
39
|
+
|
|
40
|
+
## Why?
|
|
41
|
+
|
|
42
|
+
Most holiday libraries ship giant JSON files with dates until 2050. This library **calculates dates algorithmically**, supporting:
|
|
43
|
+
|
|
44
|
+
- Fixed dates (`December 25`)
|
|
45
|
+
- Nth weekday (`3rd Monday of January`)
|
|
46
|
+
- Easter-relative (`Good Friday = Easter - 2 days`)
|
|
47
|
+
- Shift rules (`Emiliani`, `Observed US`)
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install holidays-calc
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// Only Colombia included in bundle (~3KB)
|
|
59
|
+
import { getHolidays, isHoliday, getNextHoliday } from 'holidays-calc/locales/co';
|
|
60
|
+
|
|
61
|
+
// Get all holidays for a year
|
|
62
|
+
getHolidays(2025);
|
|
63
|
+
// → [{ date: '2025-01-01', key: 'newYear', name: 'Año Nuevo' }, ...]
|
|
64
|
+
|
|
65
|
+
// Check if a date is a holiday
|
|
66
|
+
isHoliday(new Date('2025-01-01'));
|
|
67
|
+
// → { date: '2025-01-01', key: 'newYear', name: 'Año Nuevo' }
|
|
68
|
+
|
|
69
|
+
isHoliday(new Date('2025-01-02'));
|
|
70
|
+
// → null
|
|
71
|
+
|
|
72
|
+
// Get next holiday from a date
|
|
73
|
+
getNextHoliday(new Date('2025-01-02'));
|
|
74
|
+
// → { date: '2025-01-06', key: 'epiphany', name: 'Día de los Reyes Magos' }
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## i18n Support
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { getHolidays } from 'holidays-calc/locales/co';
|
|
81
|
+
import { en } from 'holidays-calc/i18n/en';
|
|
82
|
+
|
|
83
|
+
getHolidays(2025, { lang: en });
|
|
84
|
+
// → [{ date: '2025-01-01', key: 'newYear', name: "New Year's Day" }, ...]
|
|
85
|
+
|
|
86
|
+
// Custom override
|
|
87
|
+
getHolidays(2025, { lang: { ...en, newYear: 'Happy New Year!' } });
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Available Locales
|
|
91
|
+
|
|
92
|
+
| Locale | Import | Holidays | Shift Rule |
|
|
93
|
+
| ----------- | -------------------------- | -------- | ---------- |
|
|
94
|
+
| 🇨🇴 Colombia | `holidays-calc/locales/co` | 18 | Emiliani |
|
|
95
|
+
| 🇺🇸 USA | `holidays-calc/locales/us` | 10 | Observed |
|
|
96
|
+
|
|
97
|
+
## Available Languages
|
|
98
|
+
|
|
99
|
+
| Language | Import |
|
|
100
|
+
| --------- | ----------------------- |
|
|
101
|
+
| Español | `holidays-calc/i18n/es` |
|
|
102
|
+
| English | `holidays-calc/i18n/en` |
|
|
103
|
+
| Português | `holidays-calc/i18n/pt` |
|
|
104
|
+
|
|
105
|
+
## Shift Rules Explained
|
|
106
|
+
|
|
107
|
+
### Emiliani (Colombia, Argentina, Chile)
|
|
108
|
+
|
|
109
|
+
Holidays falling on weekends **move to Monday**.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// January 6, 2024 = Saturday → Monday January 8
|
|
113
|
+
{ date: '2024-01-08', key: 'epiphany', isShifted: true }
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Observed US (USA, UK)
|
|
117
|
+
|
|
118
|
+
- Saturday → Friday (before)
|
|
119
|
+
- Sunday → Monday (after)
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
// July 4, 2026 = Saturday → Friday July 3
|
|
123
|
+
{ date: '2026-07-03', key: 'independenceDayUS', isShifted: true }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Advanced: Create Your Own Locale
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import type { HolidayDefinition, Holiday, HolidayNames } from 'holidays-calc';
|
|
130
|
+
import { resolveHolidays, checkIsHoliday, findNextHoliday } from 'holidays-calc';
|
|
131
|
+
|
|
132
|
+
const definitions: HolidayDefinition[] = [
|
|
133
|
+
// Fixed date
|
|
134
|
+
{ key: 'newYear', rule: { type: 'fixed', month: 1, day: 1 } },
|
|
135
|
+
|
|
136
|
+
// Fixed with shift
|
|
137
|
+
{ key: 'christmas', rule: { type: 'fixed', month: 12, day: 25 }, shift: 'observedUS' },
|
|
138
|
+
|
|
139
|
+
// Nth weekday: 3rd Monday of January
|
|
140
|
+
{ key: 'mlkDay', rule: { type: 'nthWeekday', month: 1, weekday: 1, n: 3 } },
|
|
141
|
+
|
|
142
|
+
// Last Monday of May
|
|
143
|
+
{ key: 'memorialDay', rule: { type: 'nthWeekday', month: 5, weekday: 1, n: -1 } },
|
|
144
|
+
|
|
145
|
+
// Easter relative: Good Friday = Easter - 2
|
|
146
|
+
{ key: 'goodFriday', rule: { type: 'easterRelative', offset: -2 } },
|
|
147
|
+
|
|
148
|
+
// Custom calculation
|
|
149
|
+
{
|
|
150
|
+
key: 'custom',
|
|
151
|
+
rule: {
|
|
152
|
+
type: 'custom',
|
|
153
|
+
calc: (year) => new Date(year, 5, 15), // June 15
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
const names: HolidayNames = {
|
|
159
|
+
newYear: "New Year's Day",
|
|
160
|
+
christmas: 'Christmas',
|
|
161
|
+
// ...
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export function getHolidays(year: number): Holiday[] {
|
|
165
|
+
return resolveHolidays(definitions, year, names);
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Advanced: Use Algorithms Directly
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
import { getEasterSunday } from 'holidays-calc/core/algorithms/easter';
|
|
173
|
+
import { getNthWeekday } from 'holidays-calc/core/algorithms/nth-weekday';
|
|
174
|
+
import { applyShift } from 'holidays-calc/core/algorithms/shifts';
|
|
175
|
+
|
|
176
|
+
// Easter Sunday 2025
|
|
177
|
+
getEasterSunday(2025); // → Date(2025, 3, 20)
|
|
178
|
+
|
|
179
|
+
// 4th Thursday of November 2025 (Thanksgiving)
|
|
180
|
+
getNthWeekday(2025, 11, 4, 4); // → Date(2025, 10, 27)
|
|
181
|
+
|
|
182
|
+
// Apply observed shift
|
|
183
|
+
applyShift(new Date('2026-07-04'), 'observedUS');
|
|
184
|
+
// → { date: Date(2026-07-03), shifted: true }
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Bundle Size
|
|
188
|
+
|
|
189
|
+
| Import | Size (minified) |
|
|
190
|
+
| ------------ | --------------- |
|
|
191
|
+
| `locales/co` | ~4.3KB |
|
|
192
|
+
| `locales/us` | ~3.7KB |
|
|
193
|
+
| `i18n/es` | ~1.2KB |
|
|
194
|
+
| `i18n/en` | ~1.1KB |
|
|
195
|
+
| Core only | ~1.9KB |
|
|
196
|
+
|
|
197
|
+
Tree-shaking ensures you only ship what you import.
|
|
198
|
+
|
|
199
|
+
## API Reference
|
|
200
|
+
|
|
201
|
+
### `getHolidays(year, options?)`
|
|
202
|
+
|
|
203
|
+
Returns all holidays for a given year.
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
interface GetHolidaysOptions {
|
|
207
|
+
lang?: HolidayNames; // Custom translations
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface Holiday {
|
|
211
|
+
date: string; // ISO date: '2025-01-01'
|
|
212
|
+
key: string; // Identifier: 'newYear'
|
|
213
|
+
name: string; // Display name: 'Año Nuevo'
|
|
214
|
+
isShifted?: boolean; // True if moved by shift rule
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### `isHoliday(date, options?)`
|
|
219
|
+
|
|
220
|
+
Returns holiday info if the date is a holiday, `null` otherwise.
|
|
221
|
+
|
|
222
|
+
### `getNextHoliday(from?, options?)`
|
|
223
|
+
|
|
224
|
+
Returns the next holiday from a given date (defaults to today).
|
|
225
|
+
|
|
226
|
+
## Types
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
type ShiftRule = 'none' | 'emiliani' | 'observedUS' | 'nextMonday';
|
|
230
|
+
|
|
231
|
+
type HolidayRule =
|
|
232
|
+
| { type: 'fixed'; month: number; day: number }
|
|
233
|
+
| { type: 'nthWeekday'; month: number; weekday: number; n: number }
|
|
234
|
+
| { type: 'easterRelative'; offset: number }
|
|
235
|
+
| { type: 'custom'; calc: (year: number) => Date };
|
|
236
|
+
|
|
237
|
+
interface HolidayDefinition {
|
|
238
|
+
key: string;
|
|
239
|
+
rule: HolidayRule;
|
|
240
|
+
shift?: ShiftRule;
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Contributing
|
|
245
|
+
|
|
246
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
|
247
|
+
|
|
248
|
+
## License
|
|
249
|
+
|
|
250
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
251
|
+
|
|
252
|
+
## Documentation
|
|
253
|
+
|
|
254
|
+
- [Español](docs/README.es.md)
|
|
255
|
+
|
|
256
|
+
## Contributors
|
|
257
|
+
|
|
258
|
+
Thanks goes to these wonderful people ([emoji key](https://all-contributors.js.org/docs/en/emoji-key)):
|
|
259
|
+
|
|
260
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
261
|
+
<!-- prettier-ignore-start -->
|
|
262
|
+
<!-- markdownlint-disable -->
|
|
263
|
+
<table>
|
|
264
|
+
<tbody>
|
|
265
|
+
<tr>
|
|
266
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bledxs"><img src="https://avatars.githubusercontent.com/u/90062924?v=4" width="100px;" alt="Luis C. Rojas"/><br /><sub><b>Luis C. Rojas</b></sub></a><br /><a href="https://github.com/bledxs/soff-date/commits?author=bledxs" title="Code">💻</a> <a href="https://github.com/bledxs/soff-date/commits?author=bledxs" title="Documentation">📖</a> <a href="#maintenance-bledxs" title="Maintenance">🚧</a></td>
|
|
267
|
+
</tr>
|
|
268
|
+
</tbody>
|
|
269
|
+
</table>
|
|
270
|
+
|
|
271
|
+
<!-- markdownlint-restore -->
|
|
272
|
+
<!-- prettier-ignore-end -->
|
|
273
|
+
|
|
274
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
275
|
+
|
|
276
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function D(t){let s=t%19,o=Math.floor(t/100),a=t%100,h=Math.floor(o/4),r=o%4,l=Math.floor((o+8)/25),e=Math.floor((o-l+1)/3),n=(19*s+o-h-e+15)%30,M=Math.floor(a/4),u=a%4,c=(32+2*r+2*M-n-u)%7,f=Math.floor((s+11*n+22*c)/451),d=Math.floor((n+c-7*f+114)/31),m=(n+c-7*f+114)%31+1;return new Date(Date.UTC(t,d-1,m))}exports.getEasterSunday=D;//# sourceMappingURL=easter.cjs.map
|
|
2
|
+
//# sourceMappingURL=easter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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AO,IAAI,IAAA,CAAK,IAAA,CAAK,GAAA,CAAIZ,EAAMa,CAAAA,CAAQ,CAAA,CAAGC,CAAG,CAAC,CAChD","file":"easter.cjs","sourcesContent":["/**\n * Calculates Easter Sunday (Meeus/Jones/Butcher algorithm)\n * Valid for Gregorian calendar (1583+)\n */\nexport function getEasterSunday(year: number): Date {\n const a = year % 19;\n const b = Math.floor(year / 100);\n const c = year % 100;\n const d = Math.floor(b / 4);\n const e = b % 4;\n const f = Math.floor((b + 8) / 25);\n const g = Math.floor((b - f + 1) / 3);\n const h = (19 * a + b - d - g + 15) % 30;\n const i = Math.floor(c / 4);\n const k = c % 4;\n const l = (32 + 2 * e + 2 * i - h - k) % 7;\n const m = Math.floor((a + 11 * h + 22 * l) / 451);\n const month = Math.floor((h + l - 7 * m + 114) / 31);\n const day = ((h + l - 7 * m + 114) % 31) + 1;\n\n return new Date(Date.UTC(year, month - 1, day));\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function D(t){let s=t%19,o=Math.floor(t/100),a=t%100,h=Math.floor(o/4),r=o%4,l=Math.floor((o+8)/25),e=Math.floor((o-l+1)/3),n=(19*s+o-h-e+15)%30,M=Math.floor(a/4),u=a%4,c=(32+2*r+2*M-n-u)%7,f=Math.floor((s+11*n+22*c)/451),d=Math.floor((n+c-7*f+114)/31),m=(n+c-7*f+114)%31+1;return new Date(Date.UTC(t,d-1,m))}export{D as getEasterSunday};//# sourceMappingURL=easter.js.map
|
|
2
|
+
//# sourceMappingURL=easter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/algorithms/easter.ts"],"names":["getEasterSunday","year","a","b","c","d","e","f","g","h","i","k","l","m","month","day"],"mappings":"AAIO,SAASA,CAAAA,CAAgBC,EAAoB,CAClD,IAAMC,EAAID,CAAAA,CAAO,EAAA,CACXE,CAAAA,CAAI,IAAA,CAAK,KAAA,CAAMF,CAAAA,CAAO,GAAG,CAAA,CACzBG,CAAAA,CAAIH,CAAAA,CAAO,GAAA,CACXI,CAAAA,CAAI,IAAA,CAAK,MAAMF,CAAAA,CAAI,CAAC,CAAA,CACpBG,CAAAA,CAAIH,CAAAA,CAAI,CAAA,CACRI,EAAI,IAAA,CAAK,KAAA,CAAA,CAAOJ,EAAI,CAAA,EAAK,EAAE,EAC3BK,CAAAA,CAAI,IAAA,CAAK,KAAA,CAAA,CAAOL,CAAAA,CAAII,CAAAA,CAAI,CAAA,EAAK,CAAC,CAAA,CAC9BE,CAAAA,CAAAA,CAAK,EAAA,CAAKP,CAAAA,CAAIC,CAAAA,CAAIE,CAAAA,CAAIG,EAAI,EAAA,EAAM,EAAA,CAChCE,CAAAA,CAAI,IAAA,CAAK,KAAA,CAAMN,CAAAA,CAAI,CAAC,CAAA,CACpBO,CAAAA,CAAIP,EAAI,CAAA,CACRQ,CAAAA,CAAAA,CAAK,GAAK,CAAA,CAAIN,CAAAA,CAAI,CAAA,CAAII,CAAAA,CAAID,CAAAA,CAAIE,CAAAA,EAAK,EACnCE,CAAAA,CAAI,IAAA,CAAK,KAAA,CAAA,CAAOX,CAAAA,CAAI,EAAA,CAAKO,CAAAA,CAAI,GAAKG,CAAAA,EAAK,GAAG,CAAA,CAC1CE,CAAAA,CAAQ,IAAA,CAAK,KAAA,CAAA,CAAOL,EAAIG,CAAAA,CAAI,CAAA,CAAIC,EAAI,GAAA,EAAO,EAAE,EAC7CE,CAAAA,CAAAA,CAAQN,CAAAA,CAAIG,CAAAA,CAAI,CAAA,CAAIC,CAAAA,CAAI,GAAA,EAAO,GAAM,CAAA,CAE3C,OAAO,IAAI,IAAA,CAAK,IAAA,CAAK,GAAA,CAAIZ,EAAMa,CAAAA,CAAQ,CAAA,CAAGC,CAAG,CAAC,CAChD","file":"easter.js","sourcesContent":["/**\n * Calculates Easter Sunday (Meeus/Jones/Butcher algorithm)\n * Valid for Gregorian calendar (1583+)\n */\nexport function getEasterSunday(year: number): Date {\n const a = year % 19;\n const b = Math.floor(year / 100);\n const c = year % 100;\n const d = Math.floor(b / 4);\n const e = b % 4;\n const f = Math.floor((b + 8) / 25);\n const g = Math.floor((b - f + 1) / 3);\n const h = (19 * a + b - d - g + 15) % 30;\n const i = Math.floor(c / 4);\n const k = c % 4;\n const l = (32 + 2 * e + 2 * i - h - k) % 7;\n const m = Math.floor((a + 11 * h + 22 * l) / 451);\n const month = Math.floor((h + l - 7 * m + 114) / 31);\n const day = ((h + l - 7 * m + 114) % 31) + 1;\n\n return new Date(Date.UTC(year, month - 1, day));\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function r(e,t,D,a){if(a>0){let f=new Date(Date.UTC(e,t-1,1)).getUTCDay(),s=1+(D-f+7)%7+(a-1)*7;return new Date(Date.UTC(e,t-1,s))}else {let n=new Date(Date.UTC(e,t,0)),c=(n.getUTCDay()-D+7)%7,s=n.getUTCDate()-c+(a+1)*7;return new Date(Date.UTC(e,t-1,s))}}exports.getNthWeekday=r;//# sourceMappingURL=nth-weekday.cjs.map
|
|
2
|
+
//# sourceMappingURL=nth-weekday.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/algorithms/nth-weekday.ts"],"names":["getNthWeekday","year","month","weekday","n","firstWeekday","day","last","diff"],"mappings":"aAOO,SAASA,EAAcC,CAAAA,CAAcC,CAAAA,CAAeC,CAAAA,CAAiBC,CAAAA,CAAiB,CAC3F,GAAIA,CAAAA,CAAI,CAAA,CAAG,CAGT,IAAMC,CAAAA,CADQ,IAAI,KAAK,IAAA,CAAK,GAAA,CAAIJ,EAAMC,CAAAA,CAAQ,CAAA,CAAG,CAAC,CAAC,EACxB,SAAA,EAAU,CAE/BI,EAAM,CAAA,CAAA,CADEH,CAAAA,CAAUE,EAAe,CAAA,EAAK,CAAA,CAAA,CACpBD,CAAAA,CAAI,CAAA,EAAK,EACjC,OAAO,IAAI,KAAK,IAAA,CAAK,GAAA,CAAIH,EAAMC,CAAAA,CAAQ,CAAA,CAAGI,CAAG,CAAC,CAChD,CAAA,KAAO,CAGL,IAAMC,CAAAA,CAAO,IAAI,KAAK,IAAA,CAAK,GAAA,CAAIN,CAAAA,CAAMC,CAAAA,CAAO,CAAC,CAAC,CAAA,CAExCM,GADcD,CAAAA,CAAK,SAAA,GACGJ,CAAAA,CAAU,CAAA,EAAK,CAAA,CACrCG,CAAAA,CAAMC,EAAK,UAAA,EAAW,CAAIC,GAAQJ,CAAAA,CAAI,CAAA,EAAK,EACjD,OAAO,IAAI,IAAA,CAAK,IAAA,CAAK,IAAIH,CAAAA,CAAMC,CAAAA,CAAQ,EAAGI,CAAG,CAAC,CAChD,CACF","file":"nth-weekday.cjs","sourcesContent":["/**\n * Calculates the Nth weekday of a month\n * @param year - Year\n * @param month - Month (1-12)\n * @param weekday - Weekday (0=Sun, 1=Mon, ..., 6=Sat)\n * @param n - Occurrence (1=first, 2=second, -1=last)\n */\nexport function getNthWeekday(year: number, month: number, weekday: number, n: number): Date {\n if (n > 0) {\n // From start of month\n const first = new Date(Date.UTC(year, month - 1, 1));\n const firstWeekday = first.getUTCDay();\n const diff = (weekday - firstWeekday + 7) % 7;\n const day = 1 + diff + (n - 1) * 7;\n return new Date(Date.UTC(year, month - 1, day));\n } else {\n // From end of month (n = -1 = last)\n // month is 1-12. Date.UTC(year, month, 0) gives the last day of month 'month'\n const last = new Date(Date.UTC(year, month, 0));\n const lastWeekday = last.getUTCDay();\n const diff = (lastWeekday - weekday + 7) % 7;\n const day = last.getUTCDate() - diff + (n + 1) * 7;\n return new Date(Date.UTC(year, month - 1, day));\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the Nth weekday of a month
|
|
3
|
+
* @param year - Year
|
|
4
|
+
* @param month - Month (1-12)
|
|
5
|
+
* @param weekday - Weekday (0=Sun, 1=Mon, ..., 6=Sat)
|
|
6
|
+
* @param n - Occurrence (1=first, 2=second, -1=last)
|
|
7
|
+
*/
|
|
8
|
+
declare function getNthWeekday(year: number, month: number, weekday: number, n: number): Date;
|
|
9
|
+
|
|
10
|
+
export { getNthWeekday };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the Nth weekday of a month
|
|
3
|
+
* @param year - Year
|
|
4
|
+
* @param month - Month (1-12)
|
|
5
|
+
* @param weekday - Weekday (0=Sun, 1=Mon, ..., 6=Sat)
|
|
6
|
+
* @param n - Occurrence (1=first, 2=second, -1=last)
|
|
7
|
+
*/
|
|
8
|
+
declare function getNthWeekday(year: number, month: number, weekday: number, n: number): Date;
|
|
9
|
+
|
|
10
|
+
export { getNthWeekday };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function r(e,t,D,a){if(a>0){let f=new Date(Date.UTC(e,t-1,1)).getUTCDay(),s=1+(D-f+7)%7+(a-1)*7;return new Date(Date.UTC(e,t-1,s))}else {let n=new Date(Date.UTC(e,t,0)),c=(n.getUTCDay()-D+7)%7,s=n.getUTCDate()-c+(a+1)*7;return new Date(Date.UTC(e,t-1,s))}}export{r as getNthWeekday};//# sourceMappingURL=nth-weekday.js.map
|
|
2
|
+
//# sourceMappingURL=nth-weekday.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/algorithms/nth-weekday.ts"],"names":["getNthWeekday","year","month","weekday","n","firstWeekday","day","last","diff"],"mappings":"AAOO,SAASA,EAAcC,CAAAA,CAAcC,CAAAA,CAAeC,CAAAA,CAAiBC,CAAAA,CAAiB,CAC3F,GAAIA,CAAAA,CAAI,CAAA,CAAG,CAGT,IAAMC,CAAAA,CADQ,IAAI,KAAK,IAAA,CAAK,GAAA,CAAIJ,EAAMC,CAAAA,CAAQ,CAAA,CAAG,CAAC,CAAC,EACxB,SAAA,EAAU,CAE/BI,EAAM,CAAA,CAAA,CADEH,CAAAA,CAAUE,EAAe,CAAA,EAAK,CAAA,CAAA,CACpBD,CAAAA,CAAI,CAAA,EAAK,EACjC,OAAO,IAAI,KAAK,IAAA,CAAK,GAAA,CAAIH,EAAMC,CAAAA,CAAQ,CAAA,CAAGI,CAAG,CAAC,CAChD,CAAA,KAAO,CAGL,IAAMC,CAAAA,CAAO,IAAI,KAAK,IAAA,CAAK,GAAA,CAAIN,CAAAA,CAAMC,CAAAA,CAAO,CAAC,CAAC,CAAA,CAExCM,GADcD,CAAAA,CAAK,SAAA,GACGJ,CAAAA,CAAU,CAAA,EAAK,CAAA,CACrCG,CAAAA,CAAMC,EAAK,UAAA,EAAW,CAAIC,GAAQJ,CAAAA,CAAI,CAAA,EAAK,EACjD,OAAO,IAAI,IAAA,CAAK,IAAA,CAAK,IAAIH,CAAAA,CAAMC,CAAAA,CAAQ,EAAGI,CAAG,CAAC,CAChD,CACF","file":"nth-weekday.js","sourcesContent":["/**\n * Calculates the Nth weekday of a month\n * @param year - Year\n * @param month - Month (1-12)\n * @param weekday - Weekday (0=Sun, 1=Mon, ..., 6=Sat)\n * @param n - Occurrence (1=first, 2=second, -1=last)\n */\nexport function getNthWeekday(year: number, month: number, weekday: number, n: number): Date {\n if (n > 0) {\n // From start of month\n const first = new Date(Date.UTC(year, month - 1, 1));\n const firstWeekday = first.getUTCDay();\n const diff = (weekday - firstWeekday + 7) % 7;\n const day = 1 + diff + (n - 1) * 7;\n return new Date(Date.UTC(year, month - 1, day));\n } else {\n // From end of month (n = -1 = last)\n // month is 1-12. Date.UTC(year, month, 0) gives the last day of month 'month'\n const last = new Date(Date.UTC(year, month, 0));\n const lastWeekday = last.getUTCDay();\n const diff = (lastWeekday - weekday + 7) % 7;\n const day = last.getUTCDate() - diff + (n + 1) * 7;\n return new Date(Date.UTC(year, month - 1, day));\n }\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function i(e,a){let t=e.getUTCDay();if(a==="none")return {date:e,shifted:false};let s=new Date(e);switch(a){case "emiliani":case "nextMonday":{if(t===1)return {date:e,shifted:false};let f=(8-t)%7;s.setUTCDate(e.getUTCDate()+f);break}case "observedUS":if(t===0)s.setUTCDate(e.getUTCDate()+1);else if(t===6)s.setUTCDate(e.getUTCDate()-1);else return {date:e,shifted:false};break;default:return {date:e,shifted:false}}return {date:s,shifted:true}}exports.applyShift=i;//# sourceMappingURL=shifts.cjs.map
|
|
2
|
+
//# sourceMappingURL=shifts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/algorithms/shifts.ts"],"names":["applyShift","date","rule","day","result","daysToNextMonday"],"mappings":"aAMO,SAASA,CAAAA,CAAWC,EAAYC,CAAAA,CAAmD,CACxF,IAAMC,CAAAA,CAAMF,CAAAA,CAAK,SAAA,EAAU,CAE3B,GAAIC,CAAAA,GAAS,OACX,OAAO,CAAE,KAAAD,CAAAA,CAAM,OAAA,CAAS,KAAM,CAAA,CAGhC,IAAMG,CAAAA,CAAS,IAAI,IAAA,CAAKH,CAAI,EAE5B,OAAQC,CAAAA,EACN,KAAK,UAAA,CACL,KAAK,YAAA,CAAc,CAEjB,GAAIC,CAAAA,GAAQ,CAAA,CACV,OAAO,CAAE,IAAA,CAAAF,CAAAA,CAAM,QAAS,KAAM,CAAA,CAOhC,IAAMI,CAAAA,CAAAA,CAAoB,CAAA,CAAIF,CAAAA,EAAO,CAAA,CACrCC,CAAAA,CAAO,UAAA,CAAWH,EAAK,UAAA,EAAW,CAAII,CAAgB,CAAA,CACtD,KACF,CAEA,KAAK,YAAA,CAEH,GAAIF,CAAAA,GAAQ,CAAA,CAEVC,CAAAA,CAAO,WAAWH,CAAAA,CAAK,UAAA,GAAe,CAAC,CAAA,CAAA,KAAA,GAC9BE,IAAQ,CAAA,CAEjBC,CAAAA,CAAO,UAAA,CAAWH,CAAAA,CAAK,UAAA,EAAW,CAAI,CAAC,CAAA,CAAA,KAEvC,OAAO,CAAE,IAAA,CAAAA,CAAAA,CAAM,QAAS,KAAM,CAAA,CAEhC,MAEF,QACE,OAAO,CAAE,KAAAA,CAAAA,CAAM,OAAA,CAAS,KAAM,CAClC,CAEA,OAAO,CAAE,IAAA,CAAMG,CAAAA,CAAQ,OAAA,CAAS,IAAK,CACvC","file":"shifts.cjs","sourcesContent":["import type { ShiftRule } from '../types';\n\n/**\n * Applies a shift rule to a date\n * @returns { date: Date, shifted: boolean }\n */\nexport function applyShift(date: Date, rule: ShiftRule): { date: Date; shifted: boolean } {\n const day = date.getUTCDay(); // 0=Sun, 6=Sat\n\n if (rule === 'none') {\n return { date, shifted: false };\n }\n\n const result = new Date(date);\n\n switch (rule) {\n case 'emiliani':\n case 'nextMonday': {\n // If it's already Monday (1), do not move\n if (day === 1) {\n return { date, shifted: false };\n }\n // Move to next Monday\n // (8 - day) % 7 gives days until next Monday\n // Ex: Sun(0) -> (8-0)%7 = 1 (+1 day) -> Mon\n // Ex: Sat(6) -> (8-6)%7 = 2 (+2 days) -> Mon\n // Ex: Wed(3) -> (8-3)%7 = 5 (+5 days) -> Mon\n const daysToNextMonday = (8 - day) % 7;\n result.setUTCDate(date.getUTCDate() + daysToNextMonday);\n break;\n }\n\n case 'observedUS':\n // Only affects weekends\n if (day === 0) {\n // Sunday -> Monday (+1)\n result.setUTCDate(date.getUTCDate() + 1);\n } else if (day === 6) {\n // Saturday -> Friday (-1)\n result.setUTCDate(date.getUTCDate() - 1);\n } else {\n return { date, shifted: false };\n }\n break;\n\n default:\n return { date, shifted: false };\n }\n\n return { date: result, shifted: true };\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ShiftRule } from '../types.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Applies a shift rule to a date
|
|
5
|
+
* @returns { date: Date, shifted: boolean }
|
|
6
|
+
*/
|
|
7
|
+
declare function applyShift(date: Date, rule: ShiftRule): {
|
|
8
|
+
date: Date;
|
|
9
|
+
shifted: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { applyShift };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ShiftRule } from '../types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Applies a shift rule to a date
|
|
5
|
+
* @returns { date: Date, shifted: boolean }
|
|
6
|
+
*/
|
|
7
|
+
declare function applyShift(date: Date, rule: ShiftRule): {
|
|
8
|
+
date: Date;
|
|
9
|
+
shifted: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { applyShift };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function i(e,a){let t=e.getUTCDay();if(a==="none")return {date:e,shifted:false};let s=new Date(e);switch(a){case "emiliani":case "nextMonday":{if(t===1)return {date:e,shifted:false};let f=(8-t)%7;s.setUTCDate(e.getUTCDate()+f);break}case "observedUS":if(t===0)s.setUTCDate(e.getUTCDate()+1);else if(t===6)s.setUTCDate(e.getUTCDate()-1);else return {date:e,shifted:false};break;default:return {date:e,shifted:false}}return {date:s,shifted:true}}export{i as applyShift};//# sourceMappingURL=shifts.js.map
|
|
2
|
+
//# sourceMappingURL=shifts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/algorithms/shifts.ts"],"names":["applyShift","date","rule","day","result","daysToNextMonday"],"mappings":"AAMO,SAASA,CAAAA,CAAWC,EAAYC,CAAAA,CAAmD,CACxF,IAAMC,CAAAA,CAAMF,CAAAA,CAAK,SAAA,EAAU,CAE3B,GAAIC,CAAAA,GAAS,OACX,OAAO,CAAE,KAAAD,CAAAA,CAAM,OAAA,CAAS,KAAM,CAAA,CAGhC,IAAMG,CAAAA,CAAS,IAAI,IAAA,CAAKH,CAAI,EAE5B,OAAQC,CAAAA,EACN,KAAK,UAAA,CACL,KAAK,YAAA,CAAc,CAEjB,GAAIC,CAAAA,GAAQ,CAAA,CACV,OAAO,CAAE,IAAA,CAAAF,CAAAA,CAAM,QAAS,KAAM,CAAA,CAOhC,IAAMI,CAAAA,CAAAA,CAAoB,CAAA,CAAIF,CAAAA,EAAO,CAAA,CACrCC,CAAAA,CAAO,UAAA,CAAWH,EAAK,UAAA,EAAW,CAAII,CAAgB,CAAA,CACtD,KACF,CAEA,KAAK,YAAA,CAEH,GAAIF,CAAAA,GAAQ,CAAA,CAEVC,CAAAA,CAAO,WAAWH,CAAAA,CAAK,UAAA,GAAe,CAAC,CAAA,CAAA,KAAA,GAC9BE,IAAQ,CAAA,CAEjBC,CAAAA,CAAO,UAAA,CAAWH,CAAAA,CAAK,UAAA,EAAW,CAAI,CAAC,CAAA,CAAA,KAEvC,OAAO,CAAE,IAAA,CAAAA,CAAAA,CAAM,QAAS,KAAM,CAAA,CAEhC,MAEF,QACE,OAAO,CAAE,KAAAA,CAAAA,CAAM,OAAA,CAAS,KAAM,CAClC,CAEA,OAAO,CAAE,IAAA,CAAMG,CAAAA,CAAQ,OAAA,CAAS,IAAK,CACvC","file":"shifts.js","sourcesContent":["import type { ShiftRule } from '../types';\n\n/**\n * Applies a shift rule to a date\n * @returns { date: Date, shifted: boolean }\n */\nexport function applyShift(date: Date, rule: ShiftRule): { date: Date; shifted: boolean } {\n const day = date.getUTCDay(); // 0=Sun, 6=Sat\n\n if (rule === 'none') {\n return { date, shifted: false };\n }\n\n const result = new Date(date);\n\n switch (rule) {\n case 'emiliani':\n case 'nextMonday': {\n // If it's already Monday (1), do not move\n if (day === 1) {\n return { date, shifted: false };\n }\n // Move to next Monday\n // (8 - day) % 7 gives days until next Monday\n // Ex: Sun(0) -> (8-0)%7 = 1 (+1 day) -> Mon\n // Ex: Sat(6) -> (8-6)%7 = 2 (+2 days) -> Mon\n // Ex: Wed(3) -> (8-3)%7 = 5 (+5 days) -> Mon\n const daysToNextMonday = (8 - day) % 7;\n result.setUTCDate(date.getUTCDate() + daysToNextMonday);\n break;\n }\n\n case 'observedUS':\n // Only affects weekends\n if (day === 0) {\n // Sunday -> Monday (+1)\n result.setUTCDate(date.getUTCDate() + 1);\n } else if (day === 6) {\n // Saturday -> Friday (-1)\n result.setUTCDate(date.getUTCDate() - 1);\n } else {\n return { date, shifted: false };\n }\n break;\n\n default:\n return { date, shifted: false };\n }\n\n return { date: result, shifted: true };\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function D(t){let n=t%19,o=Math.floor(t/100),e=t%100,a=Math.floor(o/4),i=o%4,s=Math.floor((o+8)/25),r=Math.floor((o-s+1)/3),c=(19*n+o-a-r+15)%30,g=Math.floor(e/4),p=e%4,l=(32+2*i+2*g-c-p)%7,u=Math.floor((n+11*c+22*l)/451),m=Math.floor((c+l-7*u+114)/31),T=(c+l-7*u+114)%31+1;return new Date(Date.UTC(t,m-1,T))}function y(t,n,o,e){if(e>0){let i=new Date(Date.UTC(t,n-1,1)).getUTCDay(),r=1+(o-i+7)%7+(e-1)*7;return new Date(Date.UTC(t,n-1,r))}else {let a=new Date(Date.UTC(t,n,0)),s=(a.getUTCDay()-o+7)%7,r=a.getUTCDate()-s+(e+1)*7;return new Date(Date.UTC(t,n-1,r))}}function h(t,n){let o=t.getUTCDay();if(n==="none")return {date:t,shifted:false};let e=new Date(t);switch(n){case "emiliani":case "nextMonday":{if(o===1)return {date:t,shifted:false};let a=(8-o)%7;e.setUTCDate(t.getUTCDate()+a);break}case "observedUS":if(o===0)e.setUTCDate(t.getUTCDate()+1);else if(o===6)e.setUTCDate(t.getUTCDate()-1);else return {date:t,shifted:false};break;default:return {date:t,shifted:false}}return {date:e,shifted:true}}function C(t,n){switch(t.type){case "fixed":return new Date(Date.UTC(n,t.month-1,t.day));case "nthWeekday":return y(n,t.month,t.weekday,t.n);case "easterRelative":{let o=D(n),e=new Date(o);return e.setUTCDate(o.getUTCDate()+t.offset),e}case "custom":return t.calc(n)}}function d(t){return t.toISOString().split("T")[0]}function f(t,n,o={}){return t.map(e=>{let a=C(e.rule,n),{date:i,shifted:s}=h(a,e.shift??"none");return {date:d(i),key:e.key,name:o[e.key]??e.key,...s&&{isShifted:true}}}).sort((e,a)=>e.date.localeCompare(a.date))}function S(t,n,o){let e=n.getUTCFullYear(),a=d(n);return f(t,e,o).find(s=>s.date===a)??null}function M(t,n,o){let e=d(n),a=n.getUTCFullYear(),i=f(t,a,o),s=i.find(r=>r.date>=e);return s||(i=f(t,a+1,o),s=i[0]),s??null}exports.checkIsHoliday=S;exports.findNextHoliday=M;exports.resolveHolidays=f;//# sourceMappingURL=engine.cjs.map
|
|
2
|
+
//# sourceMappingURL=engine.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/algorithms/easter.ts","../../src/core/algorithms/nth-weekday.ts","../../src/core/algorithms/shifts.ts","../../src/core/engine.ts"],"names":["getEasterSunday","year","a","b","c","d","e","f","g","h","i","k","m","month","day","getNthWeekday","weekday","n","firstWeekday","last","diff","applyShift","date","rule","result","daysToNextMonday","resolveRule","easter","toISODate","resolveHolidays","definitions","names","def","rawDate","shifted","checkIsHoliday","isoDate","findNextHoliday","from","isoFrom","holidays","next"],"mappings":"aAIO,SAASA,CAAAA,CAAgBC,CAAAA,CAAoB,CAClD,IAAMC,CAAAA,CAAID,CAAAA,CAAO,EAAA,CACXE,CAAAA,CAAI,IAAA,CAAK,KAAA,CAAMF,CAAAA,CAAO,GAAG,CAAA,CACzBG,CAAAA,CAAIH,CAAAA,CAAO,GAAA,CACXI,CAAAA,CAAI,IAAA,CAAK,KAAA,CAAMF,CAAAA,CAAI,CAAC,CAAA,CACpBG,CAAAA,CAAIH,CAAAA,CAAI,CAAA,CACRI,CAAAA,CAAI,IAAA,CAAK,KAAA,CAAA,CAAOJ,CAAAA,CAAI,CAAA,EAAK,EAAE,CAAA,CAC3BK,CAAAA,CAAI,IAAA,CAAK,KAAA,CAAA,CAAOL,CAAAA,CAAII,CAAAA,CAAI,CAAA,EAAK,CAAC,CAAA,CAC9BE,CAAAA,CAAAA,CAAK,EAAA,CAAKP,CAAAA,CAAIC,CAAAA,CAAIE,CAAAA,CAAIG,CAAAA,CAAI,EAAA,EAAM,EAAA,CAChCE,CAAAA,CAAI,IAAA,CAAK,KAAA,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AQ8B,CAAO,CAAA,CAGjD,OAAKE,CAAAA,GACHD,CAAAA,CAAWX,CAAAA,CAAgBC,CAAAA,CAAa7B,CAAAA,CAAO,CAAA,CAAG8B,CAAK,CAAA,CACvDU,CAAAA,CAAOD,CAAAA,CAAS,CAAC,CAAA,CAAA,CAGZC,GAAQ,IACjB","file":"engine.cjs","sourcesContent":["/**\n * Calculates Easter Sunday (Meeus/Jones/Butcher algorithm)\n * Valid for Gregorian calendar (1583+)\n */\nexport function getEasterSunday(year: number): Date {\n const a = year % 19;\n const b = Math.floor(year / 100);\n const c = year % 100;\n const d = Math.floor(b / 4);\n const e = b % 4;\n const f = Math.floor((b + 8) / 25);\n const g = Math.floor((b - f + 1) / 3);\n const h = (19 * a + b - d - g + 15) % 30;\n const i = Math.floor(c / 4);\n const k = c % 4;\n const l = (32 + 2 * e + 2 * i - h - k) % 7;\n const m = Math.floor((a + 11 * h + 22 * l) / 451);\n const month = Math.floor((h + l - 7 * m + 114) / 31);\n const day = ((h + l - 7 * m + 114) % 31) + 1;\n\n return new Date(Date.UTC(year, month - 1, day));\n}\n","/**\n * Calculates the Nth weekday of a month\n * @param year - Year\n * @param month - Month (1-12)\n * @param weekday - Weekday (0=Sun, 1=Mon, ..., 6=Sat)\n * @param n - Occurrence (1=first, 2=second, -1=last)\n */\nexport function getNthWeekday(year: number, month: number, weekday: number, n: number): Date {\n if (n > 0) {\n // From start of month\n const first = new Date(Date.UTC(year, month - 1, 1));\n const firstWeekday = first.getUTCDay();\n const diff = (weekday - firstWeekday + 7) % 7;\n const day = 1 + diff + (n - 1) * 7;\n return new Date(Date.UTC(year, month - 1, day));\n } else {\n // From end of month (n = -1 = last)\n // month is 1-12. Date.UTC(year, month, 0) gives the last day of month 'month'\n const last = new Date(Date.UTC(year, month, 0));\n const lastWeekday = last.getUTCDay();\n const diff = (lastWeekday - weekday + 7) % 7;\n const day = last.getUTCDate() - diff + (n + 1) * 7;\n return new Date(Date.UTC(year, month - 1, day));\n }\n}\n","import type { ShiftRule } from '../types';\n\n/**\n * Applies a shift rule to a date\n * @returns { date: Date, shifted: boolean }\n */\nexport function applyShift(date: Date, rule: ShiftRule): { date: Date; shifted: boolean } {\n const day = date.getUTCDay(); // 0=Sun, 6=Sat\n\n if (rule === 'none') {\n return { date, shifted: false };\n }\n\n const result = new Date(date);\n\n switch (rule) {\n case 'emiliani':\n case 'nextMonday': {\n // If it's already Monday (1), do not move\n if (day === 1) {\n return { date, shifted: false };\n }\n // Move to next Monday\n // (8 - day) % 7 gives days until next Monday\n // Ex: Sun(0) -> (8-0)%7 = 1 (+1 day) -> Mon\n // Ex: Sat(6) -> (8-6)%7 = 2 (+2 days) -> Mon\n // Ex: Wed(3) -> (8-3)%7 = 5 (+5 days) -> Mon\n const daysToNextMonday = (8 - day) % 7;\n result.setUTCDate(date.getUTCDate() + daysToNextMonday);\n break;\n }\n\n case 'observedUS':\n // Only affects weekends\n if (day === 0) {\n // Sunday -> Monday (+1)\n result.setUTCDate(date.getUTCDate() + 1);\n } else if (day === 6) {\n // Saturday -> Friday (-1)\n result.setUTCDate(date.getUTCDate() - 1);\n } else {\n return { date, shifted: false };\n }\n break;\n\n default:\n return { date, shifted: false };\n }\n\n return { date: result, shifted: true };\n}\n","import type { HolidayDefinition, HolidayRule, Holiday } from './types';\nimport { getEasterSunday } from './algorithms/easter';\nimport { getNthWeekday } from './algorithms/nth-weekday';\nimport { applyShift } from './algorithms/shifts';\n\n/** Resolves a rule to a concrete date */\nfunction resolveRule(rule: HolidayRule, year: number): Date {\n switch (rule.type) {\n case 'fixed':\n return new Date(Date.UTC(year, rule.month - 1, rule.day));\n\n case 'nthWeekday':\n return getNthWeekday(year, rule.month, rule.weekday, rule.n);\n\n case 'easterRelative': {\n const easter = getEasterSunday(year);\n const result = new Date(easter);\n result.setUTCDate(easter.getUTCDate() + rule.offset);\n return result;\n }\n\n case 'custom':\n return rule.calc(year);\n }\n}\n\n/** Formats Date to ISO string (date only) */\nfunction toISODate(date: Date): string {\n return date.toISOString().split('T')[0];\n}\n\n/** Generates holidays for a year */\nexport function resolveHolidays(\n definitions: HolidayDefinition[],\n year: number,\n names: Record<string, string> = {},\n): Holiday[] {\n return definitions\n .map((def) => {\n const rawDate = resolveRule(def.rule, year);\n const { date, shifted } = applyShift(rawDate, def.shift ?? 'none');\n\n return {\n date: toISODate(date),\n key: def.key,\n name: names[def.key] ?? def.key,\n ...(shifted && { isShifted: true }),\n };\n })\n .sort((a, b) => a.date.localeCompare(b.date));\n}\n\n/** Checks if a date is a holiday */\nexport function checkIsHoliday(\n definitions: HolidayDefinition[],\n date: Date,\n names?: Record<string, string>,\n): Holiday | null {\n const year = date.getUTCFullYear();\n const isoDate = toISODate(date);\n const holidays = resolveHolidays(definitions, year, names);\n return holidays.find((h) => h.date === isoDate) ?? null;\n}\n\n/** Gets the next holiday from a date */\nexport function findNextHoliday(\n definitions: HolidayDefinition[],\n from: Date,\n names?: Record<string, string>,\n): Holiday | null {\n const isoFrom = toISODate(from);\n const year = from.getUTCFullYear();\n\n // Search in current year\n let holidays = resolveHolidays(definitions, year, names);\n let next = holidays.find((h) => h.date >= isoFrom);\n\n // If none, search in next year\n if (!next) {\n holidays = resolveHolidays(definitions, year + 1, names);\n next = holidays[0];\n }\n\n return next ?? null;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HolidayDefinition, Holiday } from './types.cjs';
|
|
2
|
+
|
|
3
|
+
/** Generates holidays for a year */
|
|
4
|
+
declare function resolveHolidays(definitions: HolidayDefinition[], year: number, names?: Record<string, string>): Holiday[];
|
|
5
|
+
/** Checks if a date is a holiday */
|
|
6
|
+
declare function checkIsHoliday(definitions: HolidayDefinition[], date: Date, names?: Record<string, string>): Holiday | null;
|
|
7
|
+
/** Gets the next holiday from a date */
|
|
8
|
+
declare function findNextHoliday(definitions: HolidayDefinition[], from: Date, names?: Record<string, string>): Holiday | null;
|
|
9
|
+
|
|
10
|
+
export { checkIsHoliday, findNextHoliday, resolveHolidays };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HolidayDefinition, Holiday } from './types.js';
|
|
2
|
+
|
|
3
|
+
/** Generates holidays for a year */
|
|
4
|
+
declare function resolveHolidays(definitions: HolidayDefinition[], year: number, names?: Record<string, string>): Holiday[];
|
|
5
|
+
/** Checks if a date is a holiday */
|
|
6
|
+
declare function checkIsHoliday(definitions: HolidayDefinition[], date: Date, names?: Record<string, string>): Holiday | null;
|
|
7
|
+
/** Gets the next holiday from a date */
|
|
8
|
+
declare function findNextHoliday(definitions: HolidayDefinition[], from: Date, names?: Record<string, string>): Holiday | null;
|
|
9
|
+
|
|
10
|
+
export { checkIsHoliday, findNextHoliday, resolveHolidays };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function D(t){let n=t%19,o=Math.floor(t/100),e=t%100,a=Math.floor(o/4),i=o%4,s=Math.floor((o+8)/25),r=Math.floor((o-s+1)/3),c=(19*n+o-a-r+15)%30,g=Math.floor(e/4),p=e%4,l=(32+2*i+2*g-c-p)%7,u=Math.floor((n+11*c+22*l)/451),m=Math.floor((c+l-7*u+114)/31),T=(c+l-7*u+114)%31+1;return new Date(Date.UTC(t,m-1,T))}function y(t,n,o,e){if(e>0){let i=new Date(Date.UTC(t,n-1,1)).getUTCDay(),r=1+(o-i+7)%7+(e-1)*7;return new Date(Date.UTC(t,n-1,r))}else {let a=new Date(Date.UTC(t,n,0)),s=(a.getUTCDay()-o+7)%7,r=a.getUTCDate()-s+(e+1)*7;return new Date(Date.UTC(t,n-1,r))}}function h(t,n){let o=t.getUTCDay();if(n==="none")return {date:t,shifted:false};let e=new Date(t);switch(n){case "emiliani":case "nextMonday":{if(o===1)return {date:t,shifted:false};let a=(8-o)%7;e.setUTCDate(t.getUTCDate()+a);break}case "observedUS":if(o===0)e.setUTCDate(t.getUTCDate()+1);else if(o===6)e.setUTCDate(t.getUTCDate()-1);else return {date:t,shifted:false};break;default:return {date:t,shifted:false}}return {date:e,shifted:true}}function C(t,n){switch(t.type){case "fixed":return new Date(Date.UTC(n,t.month-1,t.day));case "nthWeekday":return y(n,t.month,t.weekday,t.n);case "easterRelative":{let o=D(n),e=new Date(o);return e.setUTCDate(o.getUTCDate()+t.offset),e}case "custom":return t.calc(n)}}function d(t){return t.toISOString().split("T")[0]}function f(t,n,o={}){return t.map(e=>{let a=C(e.rule,n),{date:i,shifted:s}=h(a,e.shift??"none");return {date:d(i),key:e.key,name:o[e.key]??e.key,...s&&{isShifted:true}}}).sort((e,a)=>e.date.localeCompare(a.date))}function S(t,n,o){let e=n.getUTCFullYear(),a=d(n);return f(t,e,o).find(s=>s.date===a)??null}function M(t,n,o){let e=d(n),a=n.getUTCFullYear(),i=f(t,a,o),s=i.find(r=>r.date>=e);return s||(i=f(t,a+1,o),s=i[0]),s??null}export{S as checkIsHoliday,M as findNextHoliday,f as resolveHolidays};//# sourceMappingURL=engine.js.map
|
|
2
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/algorithms/easter.ts","../../src/core/algorithms/nth-weekday.ts","../../src/core/algorithms/shifts.ts","../../src/core/engine.ts"],"names":["getEasterSunday","year","a","b","c","d","e","f","g","h","i","k","m","month","day","getNthWeekday","weekday","n","firstWeekday","last","diff","applyShift","date","rule","result","daysToNextMonday","resolveRule","easter","toISODate","resolveHolidays","definitions","names","def","rawDate","shifted","checkIsHoliday","isoDate","findNextHoliday","from","isoFrom","holidays","next"],"mappings":"AAIO,SAASA,CAAAA,CAAgBC,CAAAA,CAAoB,CAClD,IAAMC,CAAAA,CAAID,CAAAA,CAAO,EAAA,CACXE,CAAAA,CAAI,IAAA,CAAK,KAAA,CAAMF,CAAAA,CAAO,GAAG,CAAA,CACzBG,CAAAA,CAAIH,CAAAA,CAAO,GAAA,CACXI,CAAAA,CAAI,IAAA,CAAK,KAAA,CAAMF,CAAAA,CAAI,CAAC,CAAA,CACpBG,CAAAA,CAAIH,CAAAA,CAAI,CAAA,CAC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,IACrD,CAGO,SAASC,CAAAA,CACdP,CAAAA,CACAQ,CAAAA,CACAP,CAAAA,CACgB,CAChB,IAAMQ,CAAAA,CAAUX,CAAAA,CAAUU,CAAI,CAAA,CACxBrC,CAAAA,CAAOqC,CAAAA,CAAK,cAAA,EAAe,CAG7BE,CAAAA,CAAWX,CAAAA,CAAgBC,CAAAA,CAAa7B,CAAAA,CAAM8B,CAAK,CAAA,CACnDU,CAAAA,CAAOD,CAAAA,CAAS,IAAA,CAAM/B,CAAAA,EAAMA,CAAAA,CAAE,IAAA,EAAQ8B,CAAO,CAAA,CAGjD,OAAKE,CAAAA,GACHD,CAAAA,CAAWX,CAAAA,CAAgBC,CAAAA,CAAa7B,CAAAA,CAAO,CAAA,CAAG8B,CAAK,CAAA,CACvDU,CAAAA,CAAOD,CAAAA,CAAS,CAAC,CAAA,CAAA,CAGZC,GAAQ,IACjB","file":"engine.js","sourcesContent":["/**\n * Calculates Easter Sunday (Meeus/Jones/Butcher algorithm)\n * Valid for Gregorian calendar (1583+)\n */\nexport function getEasterSunday(year: number): Date {\n const a = year % 19;\n const b = Math.floor(year / 100);\n const c = year % 100;\n const d = Math.floor(b / 4);\n const e = b % 4;\n const f = Math.floor((b + 8) / 25);\n const g = Math.floor((b - f + 1) / 3);\n const h = (19 * a + b - d - g + 15) % 30;\n const i = Math.floor(c / 4);\n const k = c % 4;\n const l = (32 + 2 * e + 2 * i - h - k) % 7;\n const m = Math.floor((a + 11 * h + 22 * l) / 451);\n const month = Math.floor((h + l - 7 * m + 114) / 31);\n const day = ((h + l - 7 * m + 114) % 31) + 1;\n\n return new Date(Date.UTC(year, month - 1, day));\n}\n","/**\n * Calculates the Nth weekday of a month\n * @param year - Year\n * @param month - Month (1-12)\n * @param weekday - Weekday (0=Sun, 1=Mon, ..., 6=Sat)\n * @param n - Occurrence (1=first, 2=second, -1=last)\n */\nexport function getNthWeekday(year: number, month: number, weekday: number, n: number): Date {\n if (n > 0) {\n // From start of month\n const first = new Date(Date.UTC(year, month - 1, 1));\n const firstWeekday = first.getUTCDay();\n const diff = (weekday - firstWeekday + 7) % 7;\n const day = 1 + diff + (n - 1) * 7;\n return new Date(Date.UTC(year, month - 1, day));\n } else {\n // From end of month (n = -1 = last)\n // month is 1-12. Date.UTC(year, month, 0) gives the last day of month 'month'\n const last = new Date(Date.UTC(year, month, 0));\n const lastWeekday = last.getUTCDay();\n const diff = (lastWeekday - weekday + 7) % 7;\n const day = last.getUTCDate() - diff + (n + 1) * 7;\n return new Date(Date.UTC(year, month - 1, day));\n }\n}\n","import type { ShiftRule } from '../types';\n\n/**\n * Applies a shift rule to a date\n * @returns { date: Date, shifted: boolean }\n */\nexport function applyShift(date: Date, rule: ShiftRule): { date: Date; shifted: boolean } {\n const day = date.getUTCDay(); // 0=Sun, 6=Sat\n\n if (rule === 'none') {\n return { date, shifted: false };\n }\n\n const result = new Date(date);\n\n switch (rule) {\n case 'emiliani':\n case 'nextMonday': {\n // If it's already Monday (1), do not move\n if (day === 1) {\n return { date, shifted: false };\n }\n // Move to next Monday\n // (8 - day) % 7 gives days until next Monday\n // Ex: Sun(0) -> (8-0)%7 = 1 (+1 day) -> Mon\n // Ex: Sat(6) -> (8-6)%7 = 2 (+2 days) -> Mon\n // Ex: Wed(3) -> (8-3)%7 = 5 (+5 days) -> Mon\n const daysToNextMonday = (8 - day) % 7;\n result.setUTCDate(date.getUTCDate() + daysToNextMonday);\n break;\n }\n\n case 'observedUS':\n // Only affects weekends\n if (day === 0) {\n // Sunday -> Monday (+1)\n result.setUTCDate(date.getUTCDate() + 1);\n } else if (day === 6) {\n // Saturday -> Friday (-1)\n result.setUTCDate(date.getUTCDate() - 1);\n } else {\n return { date, shifted: false };\n }\n break;\n\n default:\n return { date, shifted: false };\n }\n\n return { date: result, shifted: true };\n}\n","import type { HolidayDefinition, HolidayRule, Holiday } from './types';\nimport { getEasterSunday } from './algorithms/easter';\nimport { getNthWeekday } from './algorithms/nth-weekday';\nimport { applyShift } from './algorithms/shifts';\n\n/** Resolves a rule to a concrete date */\nfunction resolveRule(rule: HolidayRule, year: number): Date {\n switch (rule.type) {\n case 'fixed':\n return new Date(Date.UTC(year, rule.month - 1, rule.day));\n\n case 'nthWeekday':\n return getNthWeekday(year, rule.month, rule.weekday, rule.n);\n\n case 'easterRelative': {\n const easter = getEasterSunday(year);\n const result = new Date(easter);\n result.setUTCDate(easter.getUTCDate() + rule.offset);\n return result;\n }\n\n case 'custom':\n return rule.calc(year);\n }\n}\n\n/** Formats Date to ISO string (date only) */\nfunction toISODate(date: Date): string {\n return date.toISOString().split('T')[0];\n}\n\n/** Generates holidays for a year */\nexport function resolveHolidays(\n definitions: HolidayDefinition[],\n year: number,\n names: Record<string, string> = {},\n): Holiday[] {\n return definitions\n .map((def) => {\n const rawDate = resolveRule(def.rule, year);\n const { date, shifted } = applyShift(rawDate, def.shift ?? 'none');\n\n return {\n date: toISODate(date),\n key: def.key,\n name: names[def.key] ?? def.key,\n ...(shifted && { isShifted: true }),\n };\n })\n .sort((a, b) => a.date.localeCompare(b.date));\n}\n\n/** Checks if a date is a holiday */\nexport function checkIsHoliday(\n definitions: HolidayDefinition[],\n date: Date,\n names?: Record<string, string>,\n): Holiday | null {\n const year = date.getUTCFullYear();\n const isoDate = toISODate(date);\n const holidays = resolveHolidays(definitions, year, names);\n return holidays.find((h) => h.date === isoDate) ?? null;\n}\n\n/** Gets the next holiday from a date */\nexport function findNextHoliday(\n definitions: HolidayDefinition[],\n from: Date,\n names?: Record<string, string>,\n): Holiday | null {\n const isoFrom = toISODate(from);\n const year = from.getUTCFullYear();\n\n // Search in current year\n let holidays = resolveHolidays(definitions, year, names);\n let next = holidays.find((h) => h.date >= isoFrom);\n\n // If none, search in next year\n if (!next) {\n holidays = resolveHolidays(definitions, year + 1, names);\n next = holidays[0];\n }\n\n return next ?? null;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.cjs"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type HolidayRule = {
|
|
2
|
+
type: 'fixed';
|
|
3
|
+
month: number;
|
|
4
|
+
day: number;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'nthWeekday';
|
|
7
|
+
month: number;
|
|
8
|
+
weekday: number;
|
|
9
|
+
n: number;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'easterRelative';
|
|
12
|
+
offset: number;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'custom';
|
|
15
|
+
calc: (year: number) => Date;
|
|
16
|
+
};
|
|
17
|
+
type ShiftRule = 'none' | 'emiliani' | 'observedUS' | 'nextMonday';
|
|
18
|
+
interface HolidayDefinition {
|
|
19
|
+
key: string;
|
|
20
|
+
rule: HolidayRule;
|
|
21
|
+
shift?: ShiftRule;
|
|
22
|
+
}
|
|
23
|
+
interface Holiday {
|
|
24
|
+
date: string;
|
|
25
|
+
key: string;
|
|
26
|
+
name: string;
|
|
27
|
+
isShifted?: boolean;
|
|
28
|
+
}
|
|
29
|
+
type HolidayNames = Record<string, string>;
|
|
30
|
+
type LocaleTranslations = Record<string, HolidayNames>;
|
|
31
|
+
|
|
32
|
+
export type { Holiday, HolidayDefinition, HolidayNames, HolidayRule, LocaleTranslations, ShiftRule };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type HolidayRule = {
|
|
2
|
+
type: 'fixed';
|
|
3
|
+
month: number;
|
|
4
|
+
day: number;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'nthWeekday';
|
|
7
|
+
month: number;
|
|
8
|
+
weekday: number;
|
|
9
|
+
n: number;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'easterRelative';
|
|
12
|
+
offset: number;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'custom';
|
|
15
|
+
calc: (year: number) => Date;
|
|
16
|
+
};
|
|
17
|
+
type ShiftRule = 'none' | 'emiliani' | 'observedUS' | 'nextMonday';
|
|
18
|
+
interface HolidayDefinition {
|
|
19
|
+
key: string;
|
|
20
|
+
rule: HolidayRule;
|
|
21
|
+
shift?: ShiftRule;
|
|
22
|
+
}
|
|
23
|
+
interface Holiday {
|
|
24
|
+
date: string;
|
|
25
|
+
key: string;
|
|
26
|
+
name: string;
|
|
27
|
+
isShifted?: boolean;
|
|
28
|
+
}
|
|
29
|
+
type HolidayNames = Record<string, string>;
|
|
30
|
+
type LocaleTranslations = Record<string, HolidayNames>;
|
|
31
|
+
|
|
32
|
+
export type { Holiday, HolidayDefinition, HolidayNames, HolidayRule, LocaleTranslations, ShiftRule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
package/dist/i18n/en.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var a={newYear:"New Year's Day",epiphany:"Epiphany",holyThursday:"Holy Thursday",goodFriday:"Good Friday",easterSunday:"Easter Sunday",laborDay:"Labor Day",ascension:"Ascension Day",corpusChristi:"Corpus Christi",christmas:"Christmas Day",christmasEve:"Christmas Eve",newYearsEve:"New Year's Eve",allSaints:"All Saints' Day",saintJoseph:"Saint Joseph's Day",sacredHeart:"Sacred Heart",saintPeterPaul:"Saint Peter and Saint Paul",independenceDay:"Independence Day",boyacaBattle:"Battle of Boyac\xE1",assumptionMary:"Assumption of Mary",columbusDay:"Columbus Day",independenceCartagena:"Independence of Cartagena",immaculateConception:"Immaculate Conception",constitutionDay:"Constitution Day",benitoJuarez:"Benito Ju\xE1rez Birthday",revolutionDay:"Revolution Day",virginGuadalupe:"Our Lady of Guadalupe",mlkDay:"Martin Luther King Jr. Day",presidentsDay:"Presidents' Day",memorialDay:"Memorial Day",independenceDayUS:"Independence Day",thanksgivingDay:"Thanksgiving Day",veteransDay:"Veterans Day"};exports.en=a;//# sourceMappingURL=en.cjs.map
|
|
2
|
+
//# sourceMappingURL=en.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/i18n/en.ts"],"names":["en"],"mappings":"aAEO,IAAMA,CAAAA,CAAmB,CAE9B,OAAA,CAAS,gBAAA,CACT,QAAA,CAAU,UAAA,CACV,YAAA,CAAc,eAAA,CACd,UAAA,CAAY,aAAA,CACZ,YAAA,CAAc,eAAA,CACd,QAAA,CAAU,WAAA,CACV,SAAA,CAAW,eAAA,CACX,aAAA,CAAe,gBAAA,CACf,SAAA,CAAW,eAAA,CACX,YAAA,CAAc,eAAA,CACd,WAAA,CAAa,gBAAA,CACb,SAAA,CAAW,iBAAA,CAGX,WAAA,CAAa,oBAAA,CACb,YAAa,cAAA,CACb,cAAA,CAAgB,4BAAA,CAChB,eAAA,CAAiB,kBAAA,CACjB,YAAA,CAAc,qBAAA,CACd,cAAA,CAAgB,oBAAA,CAChB,WAAA,CAAa,cAAA,CACb,qBAAA,CAAuB,2BAAA,CACvB,oBAAA,CAAsB,uBAAA,CAGtB,eAAA,CAAiB,mBACjB,YAAA,CAAc,2BAAA,CACd,aAAA,CAAe,gBAAA,CACf,eAAA,CAAiB,uBAAA,CAGjB,MAAA,CAAQ,4BAAA,CACR,aAAA,CAAe,iBAAA,CACf,WAAA,CAAa,cAAA,CACb,iBAAA,CAAmB,kBAAA,CACnB,eAAA,CAAiB,kBAAA,CACjB,YAAa,cACf","file":"en.cjs","sourcesContent":["import type { HolidayNames } from '../core/types';\n\nexport const en: HolidayNames = {\n // Common\n newYear: \"New Year's Day\",\n epiphany: 'Epiphany',\n holyThursday: 'Holy Thursday',\n goodFriday: 'Good Friday',\n easterSunday: 'Easter Sunday',\n laborDay: 'Labor Day',\n ascension: 'Ascension Day',\n corpusChristi: 'Corpus Christi',\n christmas: 'Christmas Day',\n christmasEve: 'Christmas Eve',\n newYearsEve: \"New Year's Eve\",\n allSaints: \"All Saints' Day\",\n\n // Colombia\n saintJoseph: \"Saint Joseph's Day\",\n sacredHeart: 'Sacred Heart',\n saintPeterPaul: 'Saint Peter and Saint Paul',\n independenceDay: 'Independence Day',\n boyacaBattle: 'Battle of Boyacá',\n assumptionMary: 'Assumption of Mary',\n columbusDay: 'Columbus Day',\n independenceCartagena: 'Independence of Cartagena',\n immaculateConception: 'Immaculate Conception',\n\n // Mexico\n constitutionDay: 'Constitution Day',\n benitoJuarez: 'Benito Juárez Birthday',\n revolutionDay: 'Revolution Day',\n virginGuadalupe: 'Our Lady of Guadalupe',\n\n // USA\n mlkDay: 'Martin Luther King Jr. Day',\n presidentsDay: \"Presidents' Day\",\n memorialDay: 'Memorial Day',\n independenceDayUS: 'Independence Day',\n thanksgivingDay: 'Thanksgiving Day',\n veteransDay: 'Veterans Day',\n};\n"]}
|