pakdatakit 1.0.2 → 2.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 -21
- package/README.md +907 -597
- package/dist/address.cjs +17 -0
- package/dist/address.d.cts +36 -0
- package/dist/address.d.ts +36 -0
- package/dist/address.js +4 -0
- package/dist/chunk-3COX5FSL.cjs +1650 -0
- package/dist/chunk-422X6FEZ.cjs +220 -0
- package/dist/chunk-432ZYMYV.js +31 -0
- package/dist/chunk-4VVFS6FN.cjs +715 -0
- package/dist/chunk-6TSKA2PH.js +38 -0
- package/dist/chunk-APXP7OK7.cjs +226 -0
- package/dist/chunk-AUATLZA5.cjs +168 -0
- package/dist/chunk-BSS4Z7NI.cjs +422 -0
- package/dist/chunk-CEPNSHIC.js +33 -0
- package/dist/chunk-CQKK3S7A.js +217 -0
- package/dist/chunk-CYJJ7KGC.cjs +108 -0
- package/dist/chunk-EEVNLTB4.js +32 -0
- package/dist/chunk-ENQ7O7VW.js +32 -0
- package/dist/chunk-H4DVWUYH.js +231 -0
- package/dist/chunk-H6M6L26S.cjs +37 -0
- package/dist/chunk-HBOZIITD.js +351 -0
- package/dist/chunk-HTCSHHOR.cjs +35 -0
- package/dist/chunk-JKE4AMSZ.js +47 -0
- package/dist/chunk-K6CZFCX6.js +1642 -0
- package/dist/chunk-KEHCTYLO.cjs +52 -0
- package/dist/chunk-KQKW2ZEK.cjs +18 -0
- package/dist/chunk-L2BDDM2W.js +165 -0
- package/dist/chunk-L45UXUWX.js +21 -0
- package/dist/chunk-LIYNKIKS.js +709 -0
- package/dist/chunk-LVHTH4P7.cjs +41 -0
- package/dist/chunk-OVUR47QH.cjs +22 -0
- package/dist/chunk-P4CGOJEM.js +16 -0
- package/dist/chunk-PHHKIMO2.cjs +35 -0
- package/dist/chunk-QQQKISXT.js +223 -0
- package/dist/chunk-T3E4B5MJ.js +417 -0
- package/dist/chunk-VPBMIYO2.cjs +38 -0
- package/dist/chunk-WPKV5JT3.cjs +235 -0
- package/dist/chunk-XCXFGTHW.cjs +355 -0
- package/dist/chunk-XT4ZNXRC.js +20 -0
- package/dist/chunk-Y6BUGLXU.js +95 -0
- package/dist/chunk-YLWZGSFY.cjs +99 -0
- package/dist/chunk-YS7MOLK2.cjs +23 -0
- package/dist/chunk-Z5JEIQVW.js +102 -0
- package/dist/cli.js +129 -0
- package/dist/cnic.cjs +15 -0
- package/dist/cnic.d.cts +35 -0
- package/dist/cnic.d.ts +35 -0
- package/dist/cnic.js +2 -0
- package/dist/format.cjs +14 -0
- package/dist/format.d.cts +27 -0
- package/dist/format.d.ts +27 -0
- package/dist/format.js +1 -0
- package/dist/geo.cjs +27 -0
- package/dist/geo.d.cts +43 -0
- package/dist/geo.d.ts +43 -0
- package/dist/geo.js +2 -0
- package/dist/hijri.cjs +26 -0
- package/dist/hijri.d.cts +62 -0
- package/dist/hijri.d.ts +62 -0
- package/dist/hijri.js +1 -0
- package/dist/holidays.cjs +19 -0
- package/dist/holidays.d.cts +72 -0
- package/dist/holidays.d.ts +72 -0
- package/dist/holidays.js +2 -0
- package/dist/iban.cjs +15 -0
- package/dist/iban.d.cts +21 -0
- package/dist/iban.d.ts +21 -0
- package/dist/iban.js +2 -0
- package/dist/index.cjs +211 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -190
- package/dist/index.js +18 -2465
- package/dist/networks.cjs +12 -0
- package/dist/networks.d.cts +20 -0
- package/dist/networks.d.ts +20 -0
- package/dist/networks.js +3 -0
- package/dist/numbers.cjs +24 -0
- package/dist/numbers.d.cts +53 -0
- package/dist/numbers.d.ts +53 -0
- package/dist/numbers.js +3 -0
- package/dist/phone.cjs +29 -0
- package/dist/phone.d.cts +56 -0
- package/dist/phone.d.ts +56 -0
- package/dist/phone.js +4 -0
- package/dist/postal.cjs +27 -0
- package/dist/postal.d.cts +40 -0
- package/dist/postal.d.ts +40 -0
- package/dist/postal.js +2 -0
- package/dist/raast.cjs +20 -0
- package/dist/raast.d.cts +119 -0
- package/dist/raast.d.ts +119 -0
- package/dist/raast.js +3 -0
- package/dist/rules-GxgPiVws.d.cts +7 -0
- package/dist/rules-GxgPiVws.d.ts +7 -0
- package/dist/tax.cjs +20 -0
- package/dist/tax.d.cts +47 -0
- package/dist/tax.d.ts +47 -0
- package/dist/tax.js +3 -0
- package/dist/text.cjs +23 -0
- package/dist/text.d.cts +34 -0
- package/dist/text.d.ts +34 -0
- package/dist/text.js +2 -0
- package/dist/valibot.cjs +47 -0
- package/dist/valibot.d.cts +22 -0
- package/dist/valibot.d.ts +22 -0
- package/dist/valibot.js +25 -0
- package/dist/whatsapp.cjs +12 -0
- package/dist/whatsapp.d.cts +12 -0
- package/dist/whatsapp.d.ts +12 -0
- package/dist/whatsapp.js +3 -0
- package/dist/words.cjs +14 -0
- package/dist/words.d.cts +49 -0
- package/dist/words.d.ts +49 -0
- package/dist/words.js +1 -0
- package/dist/yup.cjs +32 -0
- package/dist/yup.d.cts +22 -0
- package/dist/yup.d.ts +22 -0
- package/dist/yup.js +30 -0
- package/dist/zod.cjs +27 -0
- package/dist/zod.d.cts +22 -0
- package/dist/zod.d.ts +22 -0
- package/dist/zod.js +25 -0
- package/package.json +309 -69
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { toHijri, fromHijri } from './chunk-Z5JEIQVW.js';
|
|
2
|
+
|
|
3
|
+
// data/holidays.json
|
|
4
|
+
var holidays_default = {
|
|
5
|
+
"2020": {
|
|
6
|
+
eidUlFitr: {
|
|
7
|
+
dates: [
|
|
8
|
+
"2020-05-22",
|
|
9
|
+
"2020-05-23",
|
|
10
|
+
"2020-05-24",
|
|
11
|
+
"2020-05-25",
|
|
12
|
+
"2020-05-26",
|
|
13
|
+
"2020-05-27"
|
|
14
|
+
],
|
|
15
|
+
source: "https://www.sbp.org.pk/bprd/2020/CL23.htm"
|
|
16
|
+
},
|
|
17
|
+
eidUlAdha: {
|
|
18
|
+
dates: ["2020-07-31", "2020-08-01", "2020-08-02"],
|
|
19
|
+
source: "https://www.sbp.org.pk/bprd/2020/CL35.htm"
|
|
20
|
+
},
|
|
21
|
+
ashura: {
|
|
22
|
+
dates: ["2020-08-29", "2020-08-30"],
|
|
23
|
+
source: "https://arynews.tv/muharram-moon-sighting-youm-i-ashur-ruet-e-hilal-committee"
|
|
24
|
+
},
|
|
25
|
+
eidMiladUnNabi: {
|
|
26
|
+
dates: ["2020-10-30"],
|
|
27
|
+
source: "https://www.geo.tv/latest/313746-rabiul-awwal-moon-not-sighted-eid-i-miladun-nabi-on-oct-30"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"2021": {
|
|
31
|
+
eidUlFitr: {
|
|
32
|
+
dates: [
|
|
33
|
+
"2021-05-10",
|
|
34
|
+
"2021-05-11",
|
|
35
|
+
"2021-05-12",
|
|
36
|
+
"2021-05-13",
|
|
37
|
+
"2021-05-14",
|
|
38
|
+
"2021-05-15"
|
|
39
|
+
],
|
|
40
|
+
source: "https://www.sbp.org.pk/bprd/2021/CL13.htm"
|
|
41
|
+
},
|
|
42
|
+
eidUlAdha: {
|
|
43
|
+
dates: ["2021-07-20", "2021-07-21", "2021-07-22"],
|
|
44
|
+
source: "https://www.sbp.org.pk/press/2021/Pr-15-Jul-2021.pdf"
|
|
45
|
+
},
|
|
46
|
+
ashura: {
|
|
47
|
+
dates: ["2021-08-18", "2021-08-19"],
|
|
48
|
+
source: "https://propakistani.pk/2021/08/13/govt-announces-ashura-holidays/"
|
|
49
|
+
},
|
|
50
|
+
eidMiladUnNabi: {
|
|
51
|
+
dates: ["2021-10-19"],
|
|
52
|
+
source: "https://www.geo.tv/latest/376025-eid-milad-un-nabi-govt-notifies-12th-rabi-ul-awal-as-nationwide-public-holiday"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"2022": {
|
|
56
|
+
eidUlFitr: {
|
|
57
|
+
dates: ["2022-05-02", "2022-05-03", "2022-05-04", "2022-05-05"],
|
|
58
|
+
source: "https://www.sbp.org.pk/bprd/2022/CL14.htm"
|
|
59
|
+
},
|
|
60
|
+
eidUlAdha: {
|
|
61
|
+
dates: [
|
|
62
|
+
"2022-07-08",
|
|
63
|
+
"2022-07-09",
|
|
64
|
+
"2022-07-10",
|
|
65
|
+
"2022-07-11",
|
|
66
|
+
"2022-07-12"
|
|
67
|
+
],
|
|
68
|
+
source: "https://www.sbp.org.pk/bprd/2022/CL22.htm"
|
|
69
|
+
},
|
|
70
|
+
ashura: {
|
|
71
|
+
dates: ["2022-08-08", "2022-08-09"],
|
|
72
|
+
source: "https://www.sbp.org.pk/bprd/2022/CL24.htm"
|
|
73
|
+
},
|
|
74
|
+
eidMiladUnNabi: {
|
|
75
|
+
dates: ["2022-10-09"],
|
|
76
|
+
source: "https://www.thenews.com.pk/latest/994846-rabiul-awwal-moon-not-sighted-eid-milad-un-nabi-pbuh-to-be-observed-on-october-9"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"2023": {
|
|
80
|
+
eidUlFitr: {
|
|
81
|
+
dates: [
|
|
82
|
+
"2023-04-21",
|
|
83
|
+
"2023-04-22",
|
|
84
|
+
"2023-04-23",
|
|
85
|
+
"2023-04-24",
|
|
86
|
+
"2023-04-25"
|
|
87
|
+
],
|
|
88
|
+
source: "https://gulfnews.com/world/asia/pakistan/eid-al-fitr-2023-pakistan-announces-five-day-holiday-1.95122615"
|
|
89
|
+
},
|
|
90
|
+
eidUlAdha: {
|
|
91
|
+
dates: ["2023-06-28", "2023-06-29", "2023-06-30"],
|
|
92
|
+
source: "https://cabinet.gov.pk/SiteImage/Misc/files/Holidays/N-22-06-2023.pdf"
|
|
93
|
+
},
|
|
94
|
+
ashura: {
|
|
95
|
+
dates: ["2023-07-28", "2023-07-29"],
|
|
96
|
+
source: "https://thestandard.com.pk/government-announces-public-holidays-on-july-28-29-for-ashura/"
|
|
97
|
+
},
|
|
98
|
+
eidMiladUnNabi: {
|
|
99
|
+
dates: ["2023-09-29"],
|
|
100
|
+
source: "https://www.sbp.org.pk/bprd/2023/CL18.htm"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"2024": {
|
|
104
|
+
eidUlFitr: {
|
|
105
|
+
dates: ["2024-04-10", "2024-04-11", "2024-04-12"],
|
|
106
|
+
source: "https://thefridaytimes.com/04-Apr-2024/govt-announces-eidul-fitr-holidays-from-april-10"
|
|
107
|
+
},
|
|
108
|
+
eidUlAdha: {
|
|
109
|
+
dates: ["2024-06-17", "2024-06-18", "2024-06-19"],
|
|
110
|
+
source: "https://english.aaj.tv/news/330364828/govt-announces-eid-ul-adha-hoildays"
|
|
111
|
+
},
|
|
112
|
+
ashura: {
|
|
113
|
+
dates: ["2024-07-16", "2024-07-17"],
|
|
114
|
+
source: "https://www.sbp.org.pk/bprd/2024/CL14.htm"
|
|
115
|
+
},
|
|
116
|
+
eidMiladUnNabi: {
|
|
117
|
+
dates: ["2024-09-17"],
|
|
118
|
+
source: "https://www.sbp.org.pk/bprd/2024/CL18.htm"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"2025": {
|
|
122
|
+
eidUlFitr: {
|
|
123
|
+
dates: ["2025-03-31", "2025-04-01", "2025-04-02"],
|
|
124
|
+
source: "https://arynews.tv/eidul-fitr-2025-holidays-announcement-pakistan/"
|
|
125
|
+
},
|
|
126
|
+
eidUlAdha: {
|
|
127
|
+
dates: ["2025-06-06", "2025-06-07", "2025-06-08", "2025-06-09"],
|
|
128
|
+
source: "https://www.cabinet.gov.pk/SiteImage/Misc/files/Press%20Release/Eid-ul-Azha-Holidays-02_06_25.pdf"
|
|
129
|
+
},
|
|
130
|
+
ashura: {
|
|
131
|
+
dates: ["2025-07-05", "2025-07-06"],
|
|
132
|
+
source: "https://tribune.com.pk/story/2554016/govt-announces-july-5-6-holidays-on-account-of-ashura"
|
|
133
|
+
},
|
|
134
|
+
eidMiladUnNabi: {
|
|
135
|
+
dates: ["2025-09-06"],
|
|
136
|
+
source: "https://www.sbp.org.pk/bprd/2025/CL19.htm"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"2026": {
|
|
140
|
+
eidUlFitr: {
|
|
141
|
+
dates: ["2026-03-20", "2026-03-21"],
|
|
142
|
+
source: "https://www.app.com.pk/?p=1180682"
|
|
143
|
+
},
|
|
144
|
+
eidUlAdha: {
|
|
145
|
+
dates: ["2026-05-26", "2026-05-27", "2026-05-28"],
|
|
146
|
+
source: "https://pkrevenue.com/pakistan-declares-three-day-eid-ul-adha-2026-holidays/"
|
|
147
|
+
},
|
|
148
|
+
ashura: {
|
|
149
|
+
dates: ["2026-06-25", "2026-06-26"],
|
|
150
|
+
source: "https://en.dailypakistan.com.pk/22-Jun-2026/ashura-holidays-notification-june-2026"
|
|
151
|
+
},
|
|
152
|
+
eidMiladUnNabi: {
|
|
153
|
+
dates: ["2026-08-26"],
|
|
154
|
+
source: "https://www.sbp.org.pk/assets/documents/press-release/PR-25-August-2026.pdf"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// src/holidays.ts
|
|
160
|
+
var FIXED_HOLIDAYS = [
|
|
161
|
+
{
|
|
162
|
+
id: "kashmir-day",
|
|
163
|
+
name: "Kashmir Solidarity Day",
|
|
164
|
+
month: 2,
|
|
165
|
+
day: 5,
|
|
166
|
+
type: "national"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "pakistan-day",
|
|
170
|
+
name: "Pakistan Day",
|
|
171
|
+
month: 3,
|
|
172
|
+
day: 23,
|
|
173
|
+
type: "national"
|
|
174
|
+
},
|
|
175
|
+
{ id: "labour-day", name: "Labour Day", month: 5, day: 1, type: "national" },
|
|
176
|
+
{
|
|
177
|
+
id: "youm-e-takbeer",
|
|
178
|
+
name: "Youm-e-Takbeer",
|
|
179
|
+
month: 5,
|
|
180
|
+
day: 28,
|
|
181
|
+
type: "national",
|
|
182
|
+
// A one-off holiday in 2024, on the annual list since 2025.
|
|
183
|
+
appliesIn: (year) => year >= 2024
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: "independence-day",
|
|
187
|
+
name: "Independence Day",
|
|
188
|
+
month: 8,
|
|
189
|
+
day: 14,
|
|
190
|
+
type: "national"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: "iqbal-day",
|
|
194
|
+
name: "Iqbal Day",
|
|
195
|
+
month: 11,
|
|
196
|
+
day: 9,
|
|
197
|
+
type: "national",
|
|
198
|
+
// Dropped from 2015 to 2021, restored in 2022.
|
|
199
|
+
appliesIn: (year) => year <= 2014 || year >= 2022
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
id: "quaid-e-azam-day",
|
|
203
|
+
name: "Quaid-e-Azam Day / Christmas",
|
|
204
|
+
month: 12,
|
|
205
|
+
day: 25,
|
|
206
|
+
type: "national"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: "day-after-christmas",
|
|
210
|
+
name: "Day after Christmas",
|
|
211
|
+
month: 12,
|
|
212
|
+
day: 26,
|
|
213
|
+
type: "religious",
|
|
214
|
+
christiansOnly: true
|
|
215
|
+
}
|
|
216
|
+
];
|
|
217
|
+
var ISLAMIC_HOLIDAYS = [
|
|
218
|
+
{
|
|
219
|
+
id: "eid-ul-fitr",
|
|
220
|
+
key: "eidUlFitr",
|
|
221
|
+
name: "Eid ul Fitr",
|
|
222
|
+
hijriMonth: 10,
|
|
223
|
+
hijriDay: 1,
|
|
224
|
+
days: 3
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: "eid-ul-adha",
|
|
228
|
+
key: "eidUlAdha",
|
|
229
|
+
name: "Eid ul Adha",
|
|
230
|
+
hijriMonth: 12,
|
|
231
|
+
hijriDay: 10,
|
|
232
|
+
days: 3
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: "ashura",
|
|
236
|
+
key: "ashura",
|
|
237
|
+
name: "Ashura",
|
|
238
|
+
hijriMonth: 1,
|
|
239
|
+
hijriDay: 9,
|
|
240
|
+
days: 2
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
id: "eid-milad-un-nabi",
|
|
244
|
+
key: "eidMiladUnNabi",
|
|
245
|
+
name: "Eid Milad un Nabi",
|
|
246
|
+
hijriMonth: 3,
|
|
247
|
+
hijriDay: 12,
|
|
248
|
+
days: 1
|
|
249
|
+
}
|
|
250
|
+
];
|
|
251
|
+
var OBSERVED = holidays_default;
|
|
252
|
+
function isoDate(date) {
|
|
253
|
+
return [
|
|
254
|
+
String(date.getFullYear()).padStart(4, "0"),
|
|
255
|
+
String(date.getMonth() + 1).padStart(2, "0"),
|
|
256
|
+
String(date.getDate()).padStart(2, "0")
|
|
257
|
+
].join("-");
|
|
258
|
+
}
|
|
259
|
+
function assertIsoDate(value) {
|
|
260
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
261
|
+
throw new RangeError(`Expected a YYYY-MM-DD date, received ${value}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function estimateIslamicDates(holiday, year, offset) {
|
|
265
|
+
const firstHijriYear = toHijri(new Date(year, 0, 1)).year;
|
|
266
|
+
const dates = [];
|
|
267
|
+
for (let hijriYear = firstHijriYear; hijriYear <= firstHijriYear + 1; hijriYear += 1) {
|
|
268
|
+
const start = fromHijri(
|
|
269
|
+
{ year: hijriYear, month: holiday.hijriMonth, day: holiday.hijriDay },
|
|
270
|
+
{ offset }
|
|
271
|
+
);
|
|
272
|
+
for (let i = 0; i < holiday.days; i += 1) {
|
|
273
|
+
const day = new Date(
|
|
274
|
+
start.getFullYear(),
|
|
275
|
+
start.getMonth(),
|
|
276
|
+
start.getDate() + i
|
|
277
|
+
);
|
|
278
|
+
if (day.getFullYear() === year) {
|
|
279
|
+
dates.push(isoDate(day));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return dates;
|
|
284
|
+
}
|
|
285
|
+
function getPakistanHolidays(year, options = {}) {
|
|
286
|
+
if (!Number.isInteger(year) || year < 1948 || year > 9999) {
|
|
287
|
+
throw new RangeError(`Expected a year from 1948, received ${String(year)}`);
|
|
288
|
+
}
|
|
289
|
+
const holidays = [];
|
|
290
|
+
for (const fixed of FIXED_HOLIDAYS) {
|
|
291
|
+
if (fixed.appliesIn && !fixed.appliesIn(year)) continue;
|
|
292
|
+
if (fixed.christiansOnly && !options.includeChristianHolidays) continue;
|
|
293
|
+
holidays.push({
|
|
294
|
+
id: fixed.id,
|
|
295
|
+
name: fixed.name,
|
|
296
|
+
date: isoDate(new Date(year, fixed.month - 1, fixed.day)),
|
|
297
|
+
type: fixed.type,
|
|
298
|
+
estimated: false,
|
|
299
|
+
...fixed.christiansOnly ? { christiansOnly: true } : {}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
const observed = OBSERVED[String(year)];
|
|
303
|
+
for (const islamic of ISLAMIC_HOLIDAYS) {
|
|
304
|
+
const announced = options.announced?.[islamic.id];
|
|
305
|
+
const recorded = observed?.[islamic.key];
|
|
306
|
+
let dates;
|
|
307
|
+
let estimated = false;
|
|
308
|
+
let source;
|
|
309
|
+
if (announced) {
|
|
310
|
+
announced.forEach(assertIsoDate);
|
|
311
|
+
dates = announced;
|
|
312
|
+
} else if (recorded) {
|
|
313
|
+
dates = recorded.dates;
|
|
314
|
+
source = recorded.source;
|
|
315
|
+
} else {
|
|
316
|
+
dates = estimateIslamicDates(islamic, year, options.hijriOffset ?? 0);
|
|
317
|
+
estimated = true;
|
|
318
|
+
}
|
|
319
|
+
for (const date of dates) {
|
|
320
|
+
holidays.push({
|
|
321
|
+
id: islamic.id,
|
|
322
|
+
name: islamic.name,
|
|
323
|
+
date,
|
|
324
|
+
type: "religious",
|
|
325
|
+
estimated,
|
|
326
|
+
...source ? { source } : {}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return holidays.sort((a, b) => a.date.localeCompare(b.date));
|
|
331
|
+
}
|
|
332
|
+
function getHolidaysOn(date, options = {}) {
|
|
333
|
+
let iso;
|
|
334
|
+
if (typeof date === "string") {
|
|
335
|
+
assertIsoDate(date);
|
|
336
|
+
iso = date;
|
|
337
|
+
} else {
|
|
338
|
+
if (Number.isNaN(date.getTime())) {
|
|
339
|
+
throw new RangeError("Invalid Date");
|
|
340
|
+
}
|
|
341
|
+
iso = isoDate(date);
|
|
342
|
+
}
|
|
343
|
+
return getPakistanHolidays(Number(iso.slice(0, 4)), options).filter(
|
|
344
|
+
(holiday) => holiday.date === iso
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
function isPakistanHoliday(date, options = {}) {
|
|
348
|
+
return getHolidaysOn(date, options).length > 0;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export { getHolidaysOn, getPakistanHolidays, isPakistanHoliday };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkVPBMIYO2_cjs = require('./chunk-VPBMIYO2.cjs');
|
|
4
|
+
|
|
5
|
+
// src/cnic.ts
|
|
6
|
+
var CNIC_PATTERN = /^[1-8]\d{4}([-‐‑‒–—. ]?)\d{7}\1\d$/;
|
|
7
|
+
function validateCNIC(cnic) {
|
|
8
|
+
return CNIC_PATTERN.test(chunkVPBMIYO2_cjs.toAsciiDigits(cnic.trim()));
|
|
9
|
+
}
|
|
10
|
+
var CNIC_PROVINCES = {
|
|
11
|
+
"1": "Khyber Pakhtunkhwa",
|
|
12
|
+
"2": "Khyber Pakhtunkhwa",
|
|
13
|
+
"3": "Punjab",
|
|
14
|
+
"4": "Sindh",
|
|
15
|
+
"5": "Balochistan",
|
|
16
|
+
"6": "Islamabad Capital Territory",
|
|
17
|
+
"7": "Gilgit-Baltistan",
|
|
18
|
+
"8": "Azad Jammu and Kashmir"
|
|
19
|
+
};
|
|
20
|
+
function getCNICInfo(cnic) {
|
|
21
|
+
if (!validateCNIC(cnic)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const digits = chunkVPBMIYO2_cjs.toAsciiDigits(cnic).replace(/\D/g, "");
|
|
25
|
+
const lastDigit = Number(digits[12]);
|
|
26
|
+
return {
|
|
27
|
+
digits,
|
|
28
|
+
formatted: `${digits.slice(0, 5)}-${digits.slice(5, 12)}-${digits[12]}`,
|
|
29
|
+
province: CNIC_PROVINCES[digits[0]],
|
|
30
|
+
gender: lastDigit % 2 === 1 ? "male" : "female"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.getCNICInfo = getCNICInfo;
|
|
35
|
+
exports.validateCNIC = validateCNIC;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { normalizeWhitespace, toAsciiDigits } from './chunk-ENQ7O7VW.js';
|
|
2
|
+
|
|
3
|
+
// src/text.ts
|
|
4
|
+
var URDU_DIGITS = "\u06F0\u06F1\u06F2\u06F3\u06F4\u06F5\u06F6\u06F7\u06F8\u06F9";
|
|
5
|
+
var ROMAN_URDU_REPLACEMENTS = [
|
|
6
|
+
[/\bkia\b/gi, "kya"],
|
|
7
|
+
[/\bker\b/gi, "kar"],
|
|
8
|
+
[/\bkr\b/gi, "kar"],
|
|
9
|
+
[/\bhy\b/gi, "hai"],
|
|
10
|
+
[/\bmujhay\b/gi, "mujhe"],
|
|
11
|
+
[/\bap\b/gi, "aap"],
|
|
12
|
+
[/\bshukria\b/gi, "shukriya"],
|
|
13
|
+
[/\bnhi\b/gi, "nahi"],
|
|
14
|
+
[/\bassalamu alaikum\b/gi, "assalamualaikum"],
|
|
15
|
+
[/\bassalam o alaikum\b/gi, "assalamualaikum"]
|
|
16
|
+
];
|
|
17
|
+
function normalizeText(text) {
|
|
18
|
+
return normalizeWhitespace(text.normalize("NFC"));
|
|
19
|
+
}
|
|
20
|
+
function normalizeRomanUrdu(text) {
|
|
21
|
+
let result = normalizeText(toEnglishDigits(text));
|
|
22
|
+
for (const [pattern, replacement] of ROMAN_URDU_REPLACEMENTS) {
|
|
23
|
+
result = result.replace(pattern, (match) => matchCase(match, replacement));
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
function toUrduDigits(text) {
|
|
28
|
+
return toAsciiDigits(text).replace(
|
|
29
|
+
/\d/g,
|
|
30
|
+
(digit) => URDU_DIGITS[Number(digit)]
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function toEnglishDigits(text) {
|
|
34
|
+
return toAsciiDigits(text);
|
|
35
|
+
}
|
|
36
|
+
function matchCase(original, replacement) {
|
|
37
|
+
if (original.length > 1 && original === original.toUpperCase()) {
|
|
38
|
+
return original;
|
|
39
|
+
}
|
|
40
|
+
const first = original[0];
|
|
41
|
+
if (first !== first.toLowerCase()) {
|
|
42
|
+
return replacement[0]?.toUpperCase() + replacement.slice(1);
|
|
43
|
+
}
|
|
44
|
+
return replacement;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { normalizeRomanUrdu, normalizeText, toEnglishDigits, toUrduDigits };
|