soff-date 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -18
- package/package.json +21 -3
package/README.md
CHANGED
|
@@ -49,14 +49,14 @@ Most holiday libraries ship giant JSON files with dates until 2050. This library
|
|
|
49
49
|
## Install
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
npm install
|
|
52
|
+
npm install soff-date
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
## Quick Start
|
|
56
56
|
|
|
57
57
|
```typescript
|
|
58
58
|
// Only Colombia included in bundle (~3KB)
|
|
59
|
-
import { getHolidays, isHoliday, getNextHoliday } from '
|
|
59
|
+
import { getHolidays, isHoliday, getNextHoliday } from 'soff-date/locales/co';
|
|
60
60
|
|
|
61
61
|
// Get all holidays for a year
|
|
62
62
|
getHolidays(2025);
|
|
@@ -77,8 +77,8 @@ getNextHoliday(new Date('2025-01-02'));
|
|
|
77
77
|
## i18n Support
|
|
78
78
|
|
|
79
79
|
```typescript
|
|
80
|
-
import { getHolidays } from '
|
|
81
|
-
import { en } from '
|
|
80
|
+
import { getHolidays } from 'soff-date/locales/co';
|
|
81
|
+
import { en } from 'soff-date/i18n/en';
|
|
82
82
|
|
|
83
83
|
getHolidays(2025, { lang: en });
|
|
84
84
|
// → [{ date: '2025-01-01', key: 'newYear', name: "New Year's Day" }, ...]
|
|
@@ -89,18 +89,18 @@ getHolidays(2025, { lang: { ...en, newYear: 'Happy New Year!' } });
|
|
|
89
89
|
|
|
90
90
|
## Available Locales
|
|
91
91
|
|
|
92
|
-
| Locale | Import
|
|
93
|
-
| ----------- |
|
|
94
|
-
| 🇨🇴 Colombia | `
|
|
95
|
-
| 🇺🇸 USA | `
|
|
92
|
+
| Locale | Import | Holidays | Shift Rule |
|
|
93
|
+
| ----------- | ---------------------- | -------- | ---------- |
|
|
94
|
+
| 🇨🇴 Colombia | `soff-date/locales/co` | 18 | Emiliani |
|
|
95
|
+
| 🇺🇸 USA | `soff-date/locales/us` | 10 | Observed |
|
|
96
96
|
|
|
97
97
|
## Available Languages
|
|
98
98
|
|
|
99
|
-
| Language | Import
|
|
100
|
-
| --------- |
|
|
101
|
-
| Español | `
|
|
102
|
-
| English | `
|
|
103
|
-
| Português | `
|
|
99
|
+
| Language | Import |
|
|
100
|
+
| --------- | ------------------- |
|
|
101
|
+
| Español | `soff-date/i18n/es` |
|
|
102
|
+
| English | `soff-date/i18n/en` |
|
|
103
|
+
| Português | `soff-date/i18n/pt` |
|
|
104
104
|
|
|
105
105
|
## Shift Rules Explained
|
|
106
106
|
|
|
@@ -126,8 +126,8 @@ Holidays falling on weekends **move to Monday**.
|
|
|
126
126
|
## Advanced: Create Your Own Locale
|
|
127
127
|
|
|
128
128
|
```typescript
|
|
129
|
-
import type { HolidayDefinition, Holiday, HolidayNames } from '
|
|
130
|
-
import { resolveHolidays, checkIsHoliday, findNextHoliday } from '
|
|
129
|
+
import type { HolidayDefinition, Holiday, HolidayNames } from 'soff-date';
|
|
130
|
+
import { resolveHolidays, checkIsHoliday, findNextHoliday } from 'soff-date';
|
|
131
131
|
|
|
132
132
|
const definitions: HolidayDefinition[] = [
|
|
133
133
|
// Fixed date
|
|
@@ -169,9 +169,9 @@ export function getHolidays(year: number): Holiday[] {
|
|
|
169
169
|
## Advanced: Use Algorithms Directly
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
|
-
import { getEasterSunday } from '
|
|
173
|
-
import { getNthWeekday } from '
|
|
174
|
-
import { applyShift } from '
|
|
172
|
+
import { getEasterSunday } from 'soff-date/core/algorithms/easter';
|
|
173
|
+
import { getNthWeekday } from 'soff-date/core/algorithms/nth-weekday';
|
|
174
|
+
import { applyShift } from 'soff-date/core/algorithms/shifts';
|
|
175
175
|
|
|
176
176
|
// Easter Sunday 2025
|
|
177
177
|
getEasterSunday(2025); // → Date(2025, 3, 20)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soff-date",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Lightweight, tree-shakeable holiday calculator with algorithmic date computation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"contributors:add": "all-contributors add",
|
|
105
105
|
"contributors:generate": "all-contributors generate",
|
|
106
106
|
"prepublishOnly": "npm run build",
|
|
107
|
-
"version": "npm run build
|
|
107
|
+
"version": "npm run build",
|
|
108
108
|
"postversion": "git push && git push --tags",
|
|
109
109
|
"prepare": "husky",
|
|
110
110
|
"commitlint": "commitlint --edit"
|
|
@@ -124,10 +124,28 @@
|
|
|
124
124
|
"date",
|
|
125
125
|
"festivos",
|
|
126
126
|
"typescript",
|
|
127
|
-
"tree-shaking"
|
|
127
|
+
"tree-shaking",
|
|
128
|
+
"colombia",
|
|
129
|
+
"usa",
|
|
130
|
+
"emiliani",
|
|
131
|
+
"working-days",
|
|
132
|
+
"business-days",
|
|
133
|
+
"date-manipulation",
|
|
134
|
+
"lightweight"
|
|
128
135
|
],
|
|
129
136
|
"author": "Luis C. Rojas",
|
|
130
137
|
"license": "MIT",
|
|
138
|
+
"repository": {
|
|
139
|
+
"type": "git",
|
|
140
|
+
"url": "git+https://github.com/bledxs/soff-date.git"
|
|
141
|
+
},
|
|
142
|
+
"bugs": {
|
|
143
|
+
"url": "https://github.com/bledxs/soff-date/issues"
|
|
144
|
+
},
|
|
145
|
+
"homepage": "https://github.com/bledxs/soff-date#readme",
|
|
146
|
+
"engines": {
|
|
147
|
+
"node": ">=20"
|
|
148
|
+
},
|
|
131
149
|
"devDependencies": {
|
|
132
150
|
"@commitlint/cli": "^20.1.0",
|
|
133
151
|
"@commitlint/config-conventional": "^20.0.0",
|