chronos-date 1.0.1 → 1.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 (102) hide show
  1. package/dist/basic-DIp_pxR2.cjs +450 -0
  2. package/dist/basic-Dputob9z.mjs +366 -0
  3. package/dist/constants.cjs +27 -1
  4. package/dist/constants.mjs +5 -1
  5. package/dist/convert-CNVL-mop.mjs +22 -0
  6. package/dist/convert-dQuGWhVm.cjs +33 -0
  7. package/dist/greet-B8ZtypgG.cjs +40 -0
  8. package/dist/greet-B9j4afzD.mjs +35 -0
  9. package/dist/guards.cjs +119 -1
  10. package/dist/guards.mjs +110 -1
  11. package/dist/helpers-CrMc9iJZ.mjs +185 -0
  12. package/dist/helpers-M_SfAbAv.cjs +262 -0
  13. package/dist/index.cjs +1461 -1
  14. package/dist/index.mjs +1458 -1
  15. package/dist/non-primitives-CT4vszrX.cjs +52 -0
  16. package/dist/non-primitives-DrQfPj1r.mjs +22 -0
  17. package/dist/plugins/banglaPlugin.cjs +121 -1
  18. package/dist/plugins/banglaPlugin.d.cts +1 -1
  19. package/dist/plugins/banglaPlugin.d.mts +1 -1
  20. package/dist/plugins/banglaPlugin.mjs +120 -1
  21. package/dist/plugins/businessPlugin.cjs +118 -1
  22. package/dist/plugins/businessPlugin.d.cts +1 -1
  23. package/dist/plugins/businessPlugin.d.mts +1 -1
  24. package/dist/plugins/businessPlugin.mjs +117 -1
  25. package/dist/plugins/dateRangePlugin.cjs +46 -1
  26. package/dist/plugins/dateRangePlugin.d.cts +1 -1
  27. package/dist/plugins/dateRangePlugin.d.mts +1 -1
  28. package/dist/plugins/dateRangePlugin.mjs +45 -1
  29. package/dist/plugins/dayPartPlugin.cjs +26 -1
  30. package/dist/plugins/dayPartPlugin.d.cts +1 -1
  31. package/dist/plugins/dayPartPlugin.d.mts +1 -1
  32. package/dist/plugins/dayPartPlugin.mjs +25 -1
  33. package/dist/plugins/durationPlugin.cjs +91 -1
  34. package/dist/plugins/durationPlugin.d.cts +1 -1
  35. package/dist/plugins/durationPlugin.d.mts +1 -1
  36. package/dist/plugins/durationPlugin.mjs +90 -1
  37. package/dist/plugins/fromNowPlugin.cjs +80 -1
  38. package/dist/plugins/fromNowPlugin.d.cts +1 -1
  39. package/dist/plugins/fromNowPlugin.d.mts +1 -1
  40. package/dist/plugins/fromNowPlugin.mjs +79 -1
  41. package/dist/plugins/greetingPlugin.cjs +19 -1
  42. package/dist/plugins/greetingPlugin.d.cts +1 -1
  43. package/dist/plugins/greetingPlugin.d.mts +1 -1
  44. package/dist/plugins/greetingPlugin.mjs +18 -1
  45. package/dist/plugins/palindromePlugin.cjs +22 -1
  46. package/dist/plugins/palindromePlugin.d.cts +1 -1
  47. package/dist/plugins/palindromePlugin.d.mts +1 -1
  48. package/dist/plugins/palindromePlugin.mjs +21 -1
  49. package/dist/plugins/relativeTimePlugin.cjs +74 -1
  50. package/dist/plugins/relativeTimePlugin.d.cts +1 -1
  51. package/dist/plugins/relativeTimePlugin.d.mts +1 -1
  52. package/dist/plugins/relativeTimePlugin.mjs +73 -1
  53. package/dist/plugins/roundPlugin.cjs +69 -1
  54. package/dist/plugins/roundPlugin.d.cts +1 -1
  55. package/dist/plugins/roundPlugin.d.mts +1 -1
  56. package/dist/plugins/roundPlugin.mjs +68 -1
  57. package/dist/plugins/seasonPlugin.cjs +31 -1
  58. package/dist/plugins/seasonPlugin.d.cts +1 -1
  59. package/dist/plugins/seasonPlugin.d.mts +1 -1
  60. package/dist/plugins/seasonPlugin.mjs +30 -1
  61. package/dist/plugins/timeZonePlugin.cjs +139 -1
  62. package/dist/plugins/timeZonePlugin.d.cts +1 -1
  63. package/dist/plugins/timeZonePlugin.d.mts +1 -1
  64. package/dist/plugins/timeZonePlugin.mjs +138 -1
  65. package/dist/plugins/zodiacPlugin.cjs +51 -1
  66. package/dist/plugins/zodiacPlugin.d.cts +1 -1
  67. package/dist/plugins/zodiacPlugin.d.mts +1 -1
  68. package/dist/plugins/zodiacPlugin.mjs +50 -1
  69. package/dist/primitives-BME3_QrA.cjs +49 -0
  70. package/dist/primitives-DEt6I7Sy.mjs +19 -0
  71. package/dist/seasons-CHnjrIKK.mjs +352 -0
  72. package/dist/seasons-CcZicoe1.cjs +418 -0
  73. package/dist/timezone-BfBXeMK_.mjs +5573 -0
  74. package/dist/timezone-DYVJJYKz.cjs +5609 -0
  75. package/dist/types.mjs +1 -1
  76. package/dist/utilities-BU4MSYS7.mjs +43 -0
  77. package/dist/utilities-CGL7F6R9.cjs +72 -0
  78. package/dist/utilities-CtOZhIYv.mjs +241 -0
  79. package/dist/utilities-bXwTPJaD.cjs +318 -0
  80. package/dist/utils.cjs +76 -1
  81. package/dist/utils.mjs +44 -1
  82. package/package.json +1 -1
  83. package/dist/basic-CKxaRSHQ.cjs +0 -1
  84. package/dist/basic-e46DaNAi.mjs +0 -1
  85. package/dist/convert-Bmp63ats.mjs +0 -1
  86. package/dist/convert-DrLrcgqz.cjs +0 -1
  87. package/dist/greet-BBsrvmkn.mjs +0 -1
  88. package/dist/greet-C-6mruI9.cjs +0 -1
  89. package/dist/helpers-DGzYnP81.cjs +0 -1
  90. package/dist/helpers-N1X_Rj_V.mjs +0 -1
  91. package/dist/non-primitives-B2EE6D6s.mjs +0 -1
  92. package/dist/non-primitives-Bu3a4WL4.cjs +0 -1
  93. package/dist/primitives-Cxss_JVF.mjs +0 -1
  94. package/dist/primitives-Db2FUp4e.cjs +0 -1
  95. package/dist/seasons-ChAIVphi.mjs +0 -1
  96. package/dist/seasons-oABOhHcX.cjs +0 -1
  97. package/dist/timezone-B10UItNO.mjs +0 -1
  98. package/dist/timezone-CWxbK_7I.cjs +0 -1
  99. package/dist/utilities-B8dOAQVD.cjs +0 -1
  100. package/dist/utilities-BJE06bms.mjs +0 -1
  101. package/dist/utilities-D2-p26DX.cjs +0 -1
  102. package/dist/utilities-DV_ohS37.mjs +0 -1
@@ -0,0 +1,366 @@
1
+ //#region src/constants/basic.ts
2
+ /** @internal Symbol for accessing Chronos internals (plugin author use only) */
3
+ const INTERNALS = Symbol("Internals");
4
+ /** Milliseconds per day */
5
+ const MS_PER_DAY = 864e5;
6
+ /** Array of strings containing all the seven week-day names, starting with `Sunday` */
7
+ const DAYS = /* @__PURE__ */ Object.freeze([
8
+ "Sunday",
9
+ "Monday",
10
+ "Tuesday",
11
+ "Wednesday",
12
+ "Thursday",
13
+ "Friday",
14
+ "Saturday"
15
+ ]);
16
+ /** Array of strings containing all the 12 month names, starting with `January` */
17
+ const MONTHS = /* @__PURE__ */ Object.freeze([
18
+ "January",
19
+ "February",
20
+ "March",
21
+ "April",
22
+ "May",
23
+ "June",
24
+ "July",
25
+ "August",
26
+ "September",
27
+ "October",
28
+ "November",
29
+ "December"
30
+ ]);
31
+ const YEAR_FORMATS = /* @__PURE__ */ Object.freeze([
32
+ "YYYY",
33
+ "YY",
34
+ "yyyy",
35
+ "yy"
36
+ ]);
37
+ const MONTH_FORMATS = /* @__PURE__ */ Object.freeze([
38
+ "M",
39
+ "MM",
40
+ "mmm",
41
+ "mmmm"
42
+ ]);
43
+ const DATE_FORMATS = /* @__PURE__ */ Object.freeze([
44
+ "DD",
45
+ "D",
46
+ "Do"
47
+ ]);
48
+ const DAY_FORMATS = /* @__PURE__ */ Object.freeze([
49
+ "d",
50
+ "dd",
51
+ "ddd"
52
+ ]);
53
+ const HOUR_FORMATS = /* @__PURE__ */ Object.freeze([
54
+ "H",
55
+ "HH",
56
+ "hh",
57
+ "h"
58
+ ]);
59
+ const MINUTE_FORMATS = /* @__PURE__ */ Object.freeze(["mm", "m"]);
60
+ const SECOND_FORMATS = /* @__PURE__ */ Object.freeze(["ss", "s"]);
61
+ const MILLISECOND_FORMATS = /* @__PURE__ */ Object.freeze(["ms", "mss"]);
62
+ const TIME_FORMATS = /* @__PURE__ */ Object.freeze(["a", "A"]);
63
+ const EXTRA_FORMATS = /* @__PURE__ */ Object.freeze([
64
+ "Z",
65
+ "ZZ",
66
+ "S",
67
+ "SS"
68
+ ]);
69
+ const SORTED_TIME_FORMATS = /* @__PURE__ */ Object.freeze([
70
+ ...YEAR_FORMATS,
71
+ ...MONTH_FORMATS,
72
+ ...DAY_FORMATS,
73
+ ...DATE_FORMATS,
74
+ ...HOUR_FORMATS,
75
+ ...MINUTE_FORMATS,
76
+ ...SECOND_FORMATS,
77
+ ...MILLISECOND_FORMATS,
78
+ ...TIME_FORMATS,
79
+ ...EXTRA_FORMATS
80
+ ].sort((a, b) => b.length - a.length));
81
+ /** Ranges for day parts. */
82
+ const DATE_PART_RANGES = /* @__PURE__ */ Object.freeze({
83
+ night: ["21", "23"],
84
+ midnight: ["00", "01"],
85
+ lateNight: ["02", "04"],
86
+ morning: ["05", "11"],
87
+ afternoon: ["12", "16"],
88
+ evening: ["17", "20"]
89
+ });
90
+ /** Western Zodiac Signs */
91
+ const WESTERN_ZODIAC_SIGNS = /* @__PURE__ */ Object.freeze([
92
+ ["Capricorn", [12, 22]],
93
+ ["Aquarius", [1, 20]],
94
+ ["Pisces", [2, 19]],
95
+ ["Aries", [3, 21]],
96
+ ["Taurus", [4, 20]],
97
+ ["Gemini", [5, 21]],
98
+ ["Cancer", [6, 21]],
99
+ ["Leo", [7, 23]],
100
+ ["Virgo", [8, 23]],
101
+ ["Libra", [9, 23]],
102
+ ["Scorpio", [10, 23]],
103
+ ["Sagittarius", [11, 22]]
104
+ ]);
105
+ /** Vedic Zodiac Sign */
106
+ const VEDIC_ZODIAC_SIGNS = /* @__PURE__ */ Object.freeze([
107
+ ["Capricorn", [1, 14]],
108
+ ["Aquarius", [2, 13]],
109
+ ["Pisces", [3, 14]],
110
+ ["Aries", [4, 14]],
111
+ ["Taurus", [5, 15]],
112
+ ["Gemini", [6, 15]],
113
+ ["Cancer", [7, 16]],
114
+ ["Leo", [8, 17]],
115
+ ["Virgo", [9, 17]],
116
+ ["Libra", [10, 17]],
117
+ ["Scorpio", [11, 16]],
118
+ ["Sagittarius", [12, 16]]
119
+ ]);
120
+ /** Zodiac Signs Presets */
121
+ const ZODIAC_PRESETS = /* @__PURE__ */ Object.freeze({
122
+ western: WESTERN_ZODIAC_SIGNS,
123
+ vedic: VEDIC_ZODIAC_SIGNS,
124
+ tropical: WESTERN_ZODIAC_SIGNS,
125
+ sidereal: VEDIC_ZODIAC_SIGNS
126
+ });
127
+ /** Map to different time units to milliseconds */
128
+ const MS_MAP = /* @__PURE__ */ Object.freeze((() => {
129
+ const s = 1e3;
130
+ const m = s * 60;
131
+ const h = m * 60;
132
+ const d = h * 24;
133
+ const w = d * 7;
134
+ const y = d * 365.25;
135
+ const mo = y / 12;
136
+ return {
137
+ y,
138
+ yr: y,
139
+ yrs: y,
140
+ year: y,
141
+ years: y,
142
+ mo,
143
+ month: mo,
144
+ months: mo,
145
+ w,
146
+ week: w,
147
+ weeks: w,
148
+ d,
149
+ day: d,
150
+ days: d,
151
+ h,
152
+ hr: h,
153
+ hrs: h,
154
+ hour: h,
155
+ hours: h,
156
+ m,
157
+ min: m,
158
+ mins: m,
159
+ minute: m,
160
+ minutes: m,
161
+ s,
162
+ sec: s,
163
+ secs: s,
164
+ second: s,
165
+ seconds: s,
166
+ ms: 1,
167
+ msec: 1,
168
+ msecs: 1,
169
+ millisecond: 1,
170
+ milliseconds: 1
171
+ };
172
+ })());
173
+ /** Bangla month days table for different variants */
174
+ const BN_MONTH_TABLES = /* @__PURE__ */ Object.freeze({
175
+ "revised-2019": {
176
+ normal: [
177
+ 31,
178
+ 31,
179
+ 31,
180
+ 31,
181
+ 31,
182
+ 31,
183
+ 30,
184
+ 30,
185
+ 30,
186
+ 30,
187
+ 29,
188
+ 30
189
+ ],
190
+ leap: [
191
+ 31,
192
+ 31,
193
+ 31,
194
+ 31,
195
+ 31,
196
+ 31,
197
+ 30,
198
+ 30,
199
+ 30,
200
+ 30,
201
+ 30,
202
+ 30
203
+ ]
204
+ },
205
+ "revised-1966": {
206
+ normal: [
207
+ 31,
208
+ 31,
209
+ 31,
210
+ 31,
211
+ 31,
212
+ 30,
213
+ 30,
214
+ 30,
215
+ 30,
216
+ 30,
217
+ 30,
218
+ 30
219
+ ],
220
+ leap: [
221
+ 31,
222
+ 31,
223
+ 31,
224
+ 31,
225
+ 31,
226
+ 30,
227
+ 30,
228
+ 30,
229
+ 30,
230
+ 30,
231
+ 31,
232
+ 30
233
+ ]
234
+ }
235
+ });
236
+ /** List of Bangla season names in Bangla and English */
237
+ const BN_SEASONS = /* @__PURE__ */ Object.freeze([
238
+ {
239
+ bn: "গ্রীষ্ম",
240
+ en: "Grisma (Summer)"
241
+ },
242
+ {
243
+ bn: "বর্ষা",
244
+ en: "Barsa (Monsoon)"
245
+ },
246
+ {
247
+ bn: "শরৎ",
248
+ en: "Sarat (Autumn)"
249
+ },
250
+ {
251
+ bn: "হেমন্ত",
252
+ en: "Hemanta (Late-Autumn)"
253
+ },
254
+ {
255
+ bn: "শীত",
256
+ en: "Shhit (Winter)"
257
+ },
258
+ {
259
+ bn: "বসন্ত",
260
+ en: "Basanta (Spring)"
261
+ }
262
+ ]);
263
+ /** List of Bangla day names in Bangla and English */
264
+ const BN_DAYS = /* @__PURE__ */ Object.freeze([
265
+ {
266
+ bn: "রবিবার",
267
+ en: "Robibar (Sunday)",
268
+ short: "র"
269
+ },
270
+ {
271
+ bn: "সোমবার",
272
+ en: "Shombar (Monday)",
273
+ short: "সো"
274
+ },
275
+ {
276
+ bn: "মঙ্গলবার",
277
+ en: "Mongolbar (Tuesday)",
278
+ short: "ম"
279
+ },
280
+ {
281
+ bn: "বুধবার",
282
+ en: "Budhbar (Wednesday)",
283
+ short: "বু"
284
+ },
285
+ {
286
+ bn: "বৃহস্পতিবার",
287
+ en: "Brihoshpotibar (Thursday)",
288
+ short: "বৃ"
289
+ },
290
+ {
291
+ bn: "শুক্রবার",
292
+ en: "Shukrobar (Friday)",
293
+ short: "শু"
294
+ },
295
+ {
296
+ bn: "শনিবার",
297
+ en: "Shonibar (Saturday)",
298
+ short: "শ"
299
+ }
300
+ ]);
301
+ /** List of Bangla month names in Bangla and English */
302
+ const BN_MONTHS = /* @__PURE__ */ Object.freeze([
303
+ {
304
+ bn: "বৈশাখ",
305
+ en: "Boishakh",
306
+ short: "বৈ"
307
+ },
308
+ {
309
+ bn: "জ্যৈষ্ঠ",
310
+ en: "Joishtho",
311
+ short: "জ্য"
312
+ },
313
+ {
314
+ bn: "আষাঢ়",
315
+ en: "Asharh",
316
+ short: "আ"
317
+ },
318
+ {
319
+ bn: "শ্রাবণ",
320
+ en: "Srabon",
321
+ short: "শ্রা"
322
+ },
323
+ {
324
+ bn: "ভাদ্র",
325
+ en: "Bhadro",
326
+ short: "ভা"
327
+ },
328
+ {
329
+ bn: "আশ্বিন",
330
+ en: "Ashwin",
331
+ short: "আ"
332
+ },
333
+ {
334
+ bn: "কার্তিক",
335
+ en: "Kartik",
336
+ short: "কা"
337
+ },
338
+ {
339
+ bn: "অগ্রহায়ণ",
340
+ en: "Ogrohayon",
341
+ short: "অ"
342
+ },
343
+ {
344
+ bn: "পৌষ",
345
+ en: "Poush",
346
+ short: "পৌ"
347
+ },
348
+ {
349
+ bn: "মাঘ",
350
+ en: "Magh",
351
+ short: "মা"
352
+ },
353
+ {
354
+ bn: "ফাল্গুন",
355
+ en: "Falgun",
356
+ short: "ফা"
357
+ },
358
+ {
359
+ bn: "চৈত্র",
360
+ en: "Choitro",
361
+ short: "চৈ"
362
+ }
363
+ ]);
364
+
365
+ //#endregion
366
+ export { DATE_PART_RANGES as a, MONTHS as c, SORTED_TIME_FORMATS as d, VEDIC_ZODIAC_SIGNS as f, BN_SEASONS as i, MS_MAP as l, ZODIAC_PRESETS as m, BN_MONTHS as n, DAYS as o, WESTERN_ZODIAC_SIGNS as p, BN_MONTH_TABLES as r, INTERNALS as s, BN_DAYS as t, MS_PER_DAY as u };
@@ -1 +1,27 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./basic-CKxaRSHQ.cjs`),t=require(`./timezone-CWxbK_7I.cjs`),n=require(`./seasons-oABOhHcX.cjs`);exports.AUSTRALIA_SEASONS=n.t,exports.BANGLADESH_SEASONS=n.n,exports.ETHIOPIA_SEASONS=n.i,exports.IANA_TZ_IDS=t.t,exports.INDIA_IMD_SEASONS=n.a,exports.INDIA_TAMIL_SEASONS=n.o,exports.INDIA_VEDIC_SEASONS=n.s,exports.JAPAN_SEASONS=n.c,exports.MONTHS=e.c,exports.NATIVE_TZ_IDS=t.n,exports.PHILIPPINES_SEASONS=n.l,exports.SEASON_PRESETS=n.u,exports.TIME_ZONES=t.r,exports.TZ_ABBREVIATIONS=t.r,exports.TIME_ZONES_NATIVE=t.i,exports.TIME_ZONE_IDS=t.a,exports.TIME_ZONE_LABELS=t.o,exports.US_ACADEMIC_SEASONS=n.d,exports.VEDIC_ZODIAC_SIGNS=e.f,exports.WEEK_DAYS=e.o,exports.WESTERN_SEASONS=n.r,exports.WESTERN_ZODIAC_SIGNS=e.p;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_basic = require('./basic-DIp_pxR2.cjs');
3
+ const require_timezone = require('./timezone-DYVJJYKz.cjs');
4
+ const require_seasons = require('./seasons-CcZicoe1.cjs');
5
+
6
+ exports.AUSTRALIA_SEASONS = require_seasons.AUSTRALIA_SEASONS;
7
+ exports.BANGLADESH_SEASONS = require_seasons.BANGLADESH_SEASONS;
8
+ exports.ETHIOPIA_SEASONS = require_seasons.ETHIOPIA_SEASONS;
9
+ exports.IANA_TZ_IDS = require_timezone.IANA_TZ_IDS;
10
+ exports.INDIA_IMD_SEASONS = require_seasons.INDIA_IMD_SEASONS;
11
+ exports.INDIA_TAMIL_SEASONS = require_seasons.INDIA_TAMIL_SEASONS;
12
+ exports.INDIA_VEDIC_SEASONS = require_seasons.INDIA_VEDIC_SEASONS;
13
+ exports.JAPAN_SEASONS = require_seasons.JAPAN_SEASONS;
14
+ exports.MONTHS = require_basic.MONTHS;
15
+ exports.NATIVE_TZ_IDS = require_timezone.NATIVE_TZ_IDS;
16
+ exports.PHILIPPINES_SEASONS = require_seasons.PHILIPPINES_SEASONS;
17
+ exports.SEASON_PRESETS = require_seasons.SEASON_PRESETS;
18
+ exports.TIME_ZONES = require_timezone.TIME_ZONES;
19
+ exports.TIME_ZONES_NATIVE = require_timezone.TIME_ZONES_NATIVE;
20
+ exports.TIME_ZONE_IDS = require_timezone.TIME_ZONE_IDS;
21
+ exports.TIME_ZONE_LABELS = require_timezone.TIME_ZONE_LABELS;
22
+ exports.TZ_ABBREVIATIONS = require_timezone.TIME_ZONES;
23
+ exports.US_ACADEMIC_SEASONS = require_seasons.US_ACADEMIC_SEASONS;
24
+ exports.VEDIC_ZODIAC_SIGNS = require_basic.VEDIC_ZODIAC_SIGNS;
25
+ exports.WEEK_DAYS = require_basic.DAYS;
26
+ exports.WESTERN_SEASONS = require_seasons.DEFAULT_SEASONS;
27
+ exports.WESTERN_ZODIAC_SIGNS = require_basic.WESTERN_ZODIAC_SIGNS;
@@ -1 +1,5 @@
1
- import{c as e,f as t,o as n,p as r}from"./basic-e46DaNAi.mjs";import{a as i,i as a,n as o,o as s,r as c,t as l}from"./timezone-B10UItNO.mjs";import{a as u,c as d,d as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./seasons-ChAIVphi.mjs";export{y as AUSTRALIA_SEASONS,h as BANGLADESH_SEASONS,p as ETHIOPIA_SEASONS,l as IANA_TZ_IDS,u as INDIA_IMD_SEASONS,g as INDIA_TAMIL_SEASONS,v as INDIA_VEDIC_SEASONS,d as JAPAN_SEASONS,e as MONTHS,o as NATIVE_TZ_IDS,m as PHILIPPINES_SEASONS,b as SEASON_PRESETS,c as TIME_ZONES,c as TZ_ABBREVIATIONS,a as TIME_ZONES_NATIVE,i as TIME_ZONE_IDS,s as TIME_ZONE_LABELS,f as US_ACADEMIC_SEASONS,t as VEDIC_ZODIAC_SIGNS,n as WEEK_DAYS,_ as WESTERN_SEASONS,r as WESTERN_ZODIAC_SIGNS};
1
+ import { c as MONTHS, f as VEDIC_ZODIAC_SIGNS, o as DAYS, p as WESTERN_ZODIAC_SIGNS } from "./basic-Dputob9z.mjs";
2
+ import { a as TIME_ZONE_IDS, i as TIME_ZONES_NATIVE, n as NATIVE_TZ_IDS, o as TIME_ZONE_LABELS, r as TIME_ZONES, t as IANA_TZ_IDS } from "./timezone-BfBXeMK_.mjs";
3
+ import { a as INDIA_IMD_SEASONS, c as JAPAN_SEASONS, d as US_ACADEMIC_SEASONS, i as ETHIOPIA_SEASONS, l as PHILIPPINES_SEASONS, n as BANGLADESH_SEASONS, o as INDIA_TAMIL_SEASONS, r as DEFAULT_SEASONS, s as INDIA_VEDIC_SEASONS, t as AUSTRALIA_SEASONS, u as SEASON_PRESETS } from "./seasons-CHnjrIKK.mjs";
4
+
5
+ export { AUSTRALIA_SEASONS, BANGLADESH_SEASONS, ETHIOPIA_SEASONS, IANA_TZ_IDS, INDIA_IMD_SEASONS, INDIA_TAMIL_SEASONS, INDIA_VEDIC_SEASONS, JAPAN_SEASONS, MONTHS, NATIVE_TZ_IDS, PHILIPPINES_SEASONS, SEASON_PRESETS, TIME_ZONES, TIME_ZONES as TZ_ABBREVIATIONS, TIME_ZONES_NATIVE, TIME_ZONE_IDS, TIME_ZONE_LABELS, US_ACADEMIC_SEASONS, VEDIC_ZODIAC_SIGNS, DAYS as WEEK_DAYS, DEFAULT_SEASONS as WESTERN_SEASONS, WESTERN_ZODIAC_SIGNS };
@@ -0,0 +1,22 @@
1
+ import { n as isNonEmptyString } from "./primitives-DEt6I7Sy.mjs";
2
+
3
+ //#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/string/basics.js
4
+ function trimString(input) {
5
+ if (!input) return "";
6
+ if (isNonEmptyString(input)) return input.trim().replace(/\s+/g, " ");
7
+ if (Array.isArray(input)) return input.map((str) => isNonEmptyString(str) ? str.trim().replace(/\s+/g, " ") : str);
8
+ throw new TypeError("Expected string or array of strings!", { cause: "Invalid Input Type" });
9
+ }
10
+
11
+ //#endregion
12
+ //#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/string/convert.js
13
+ const reverseString = (input) => {
14
+ return trimString(input)?.split("")?.reverse()?.join("");
15
+ };
16
+ function formatUnitWithPlural(count, unit, withNumber = true) {
17
+ const pluralized = Math.abs(count) === 1 ? unit : `${unit}s`;
18
+ return withNumber ? `${count} ${pluralized}` : pluralized;
19
+ }
20
+
21
+ //#endregion
22
+ export { reverseString as n, formatUnitWithPlural as t };
@@ -0,0 +1,33 @@
1
+ const require_primitives = require('./primitives-BME3_QrA.cjs');
2
+
3
+ //#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/string/basics.js
4
+ function trimString(input) {
5
+ if (!input) return "";
6
+ if (require_primitives.isNonEmptyString(input)) return input.trim().replace(/\s+/g, " ");
7
+ if (Array.isArray(input)) return input.map((str) => require_primitives.isNonEmptyString(str) ? str.trim().replace(/\s+/g, " ") : str);
8
+ throw new TypeError("Expected string or array of strings!", { cause: "Invalid Input Type" });
9
+ }
10
+
11
+ //#endregion
12
+ //#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/string/convert.js
13
+ const reverseString = (input) => {
14
+ return trimString(input)?.split("")?.reverse()?.join("");
15
+ };
16
+ function formatUnitWithPlural(count, unit, withNumber = true) {
17
+ const pluralized = Math.abs(count) === 1 ? unit : `${unit}s`;
18
+ return withNumber ? `${count} ${pluralized}` : pluralized;
19
+ }
20
+
21
+ //#endregion
22
+ Object.defineProperty(exports, 'formatUnitWithPlural', {
23
+ enumerable: true,
24
+ get: function () {
25
+ return formatUnitWithPlural;
26
+ }
27
+ });
28
+ Object.defineProperty(exports, 'reverseString', {
29
+ enumerable: true,
30
+ get: function () {
31
+ return reverseString;
32
+ }
33
+ });
@@ -0,0 +1,40 @@
1
+ const require_guards = require('./guards.cjs');
2
+ const require_utilities = require('./utilities-bXwTPJaD.cjs');
3
+
4
+ //#region src/utils/greet.ts
5
+ /**
6
+ * * Returns a greeting message based on the provided time or current time.
7
+ *
8
+ * @param configs - Configuration options for greeting times and messages.
9
+ * @returns The appropriate greeting message.
10
+ */
11
+ function getGreeting(configs) {
12
+ const { morningEnds = "11:59", noonEnds = "12:59", afternoonEnds = "17:59", eveningEnds = "23:59", midnightEnds = "02:59", currentTime, appendToMsg = "", prependToMsg = "", morningMessage = "Good Morning!", noonMessage = "Good Noon!", afternoonMessage = "Good Afternoon!", eveningMessage = "Good Evening!", midnightMessage = "Hello, Night Owl!", defaultMessage = "Greetings!" } = configs || {};
13
+ let hour;
14
+ let minute;
15
+ if (currentTime && require_guards.isValidTime(currentTime)) [hour, minute] = require_utilities.extractHourMinute(currentTime);
16
+ else {
17
+ const now = /* @__PURE__ */ new Date();
18
+ hour = now.getHours();
19
+ minute = now.getMinutes();
20
+ }
21
+ const currentTotalMinutes = hour * 60 + minute;
22
+ const morningEndMinutes = require_utilities.getTotalMinutes(morningEnds);
23
+ const noonEndMinutes = require_utilities.getTotalMinutes(noonEnds);
24
+ const afternoonEndMinutes = require_utilities.getTotalMinutes(afternoonEnds);
25
+ const eveningEndMinutes = require_utilities.getTotalMinutes(eveningEnds);
26
+ if (currentTotalMinutes <= require_utilities.getTotalMinutes(midnightEnds)) return prependToMsg.concat(midnightMessage.concat(appendToMsg));
27
+ else if (currentTotalMinutes <= morningEndMinutes) return prependToMsg.concat(morningMessage.concat(appendToMsg));
28
+ else if (currentTotalMinutes <= noonEndMinutes) return prependToMsg.concat(noonMessage.concat(appendToMsg));
29
+ else if (currentTotalMinutes <= afternoonEndMinutes) return prependToMsg.concat(afternoonMessage.concat(appendToMsg));
30
+ else if (currentTotalMinutes <= eveningEndMinutes) return prependToMsg.concat(eveningMessage.concat(appendToMsg));
31
+ else return prependToMsg.concat(defaultMessage.concat(appendToMsg));
32
+ }
33
+
34
+ //#endregion
35
+ Object.defineProperty(exports, 'getGreeting', {
36
+ enumerable: true,
37
+ get: function () {
38
+ return getGreeting;
39
+ }
40
+ });
@@ -0,0 +1,35 @@
1
+ import { isValidTime } from "./guards.mjs";
2
+ import { n as extractHourMinute, p as getTotalMinutes } from "./utilities-CtOZhIYv.mjs";
3
+
4
+ //#region src/utils/greet.ts
5
+ /**
6
+ * * Returns a greeting message based on the provided time or current time.
7
+ *
8
+ * @param configs - Configuration options for greeting times and messages.
9
+ * @returns The appropriate greeting message.
10
+ */
11
+ function getGreeting(configs) {
12
+ const { morningEnds = "11:59", noonEnds = "12:59", afternoonEnds = "17:59", eveningEnds = "23:59", midnightEnds = "02:59", currentTime, appendToMsg = "", prependToMsg = "", morningMessage = "Good Morning!", noonMessage = "Good Noon!", afternoonMessage = "Good Afternoon!", eveningMessage = "Good Evening!", midnightMessage = "Hello, Night Owl!", defaultMessage = "Greetings!" } = configs || {};
13
+ let hour;
14
+ let minute;
15
+ if (currentTime && isValidTime(currentTime)) [hour, minute] = extractHourMinute(currentTime);
16
+ else {
17
+ const now = /* @__PURE__ */ new Date();
18
+ hour = now.getHours();
19
+ minute = now.getMinutes();
20
+ }
21
+ const currentTotalMinutes = hour * 60 + minute;
22
+ const morningEndMinutes = getTotalMinutes(morningEnds);
23
+ const noonEndMinutes = getTotalMinutes(noonEnds);
24
+ const afternoonEndMinutes = getTotalMinutes(afternoonEnds);
25
+ const eveningEndMinutes = getTotalMinutes(eveningEnds);
26
+ if (currentTotalMinutes <= getTotalMinutes(midnightEnds)) return prependToMsg.concat(midnightMessage.concat(appendToMsg));
27
+ else if (currentTotalMinutes <= morningEndMinutes) return prependToMsg.concat(morningMessage.concat(appendToMsg));
28
+ else if (currentTotalMinutes <= noonEndMinutes) return prependToMsg.concat(noonMessage.concat(appendToMsg));
29
+ else if (currentTotalMinutes <= afternoonEndMinutes) return prependToMsg.concat(afternoonMessage.concat(appendToMsg));
30
+ else if (currentTotalMinutes <= eveningEndMinutes) return prependToMsg.concat(eveningMessage.concat(appendToMsg));
31
+ else return prependToMsg.concat(defaultMessage.concat(appendToMsg));
32
+ }
33
+
34
+ //#endregion
35
+ export { getGreeting as t };
package/dist/guards.cjs CHANGED
@@ -1 +1,119 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./timezone-CWxbK_7I.cjs`),t=require(`./primitives-Db2FUp4e.cjs`),n=require(`./non-primitives-Bu3a4WL4.cjs`),r=require(`./utilities-D2-p26DX.cjs`);function i(e){return e instanceof Date}function a(e){return t.n(e)&&!isNaN(Date.parse(e))}function o(e){if(!t.n(e))return!1;let[n,i]=e.split(`:`);if(!r.a(n)||!r.a(i))return!1;let a=Number(n),o=Number(i);return a>=0&&a<=23&&o>=0&&o<=59}function s(e){return t.n(e)?/^UTC[+-]?\d{1,2}:\d{2}$/.test(e):!1}function c(n){return t.n(n)?new Set([...e.t]).has(n):!1}function l(n){return t.n(n)?new Set(e.n).has(n):!1}function u(e){let t=r.n(e);return t?t%4==0&&t%100!=0||t%400==0:!1}function d(e){return!!(e instanceof Date||n.r(e)&&(n.t(e.format)&&n.t(e.toJSON)&&n.t(e.toISOString)||n.t(e.toISO)&&n.t(e.toFormat)&&t.t(e.isValid)||n.t(e.plus)&&n.t(e.minus)&&n.t(e.equals)&&n.t(e.getClass)||n.t(e.toJSON)&&n.t(e.toString)&&[`PlainDate`,`ZonedDateTime`,`Instant`].includes(e.constructor?.name??``)))}function f(e){return t.n(e)&&/^-?\d*\.?\d+ *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.test(e)}exports.isDate=i,exports.isDateLike=d,exports.isDateString=a,exports.isLeapYear=u,exports.isNativeTimeZoneId=l,exports.isTimeWithUnit=f,exports.isValidTime=o,exports.isValidTimeZoneId=c,exports.isValidUTCOffset=s;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_timezone = require('./timezone-DYVJJYKz.cjs');
3
+ const require_primitives = require('./primitives-BME3_QrA.cjs');
4
+ const require_non_primitives = require('./non-primitives-CT4vszrX.cjs');
5
+ const require_utilities = require('./utilities-CGL7F6R9.cjs');
6
+
7
+ //#region src/guards.ts
8
+ /**
9
+ * * Type guard to check if a value is a Date object.
10
+ * @param value - The value to check.
11
+ * @returns `true` if the value is a Date object, otherwise `false`.
12
+ */
13
+ function isDate(value) {
14
+ return value instanceof Date;
15
+ }
16
+ /**
17
+ * * Type guard to check if a value is a valid date string.
18
+ * @param value - The value to check.
19
+ * @returns `true` if the value is a valid date string, otherwise `false`.
20
+ */
21
+ function isDateString(value) {
22
+ return require_primitives.isNonEmptyString(value) && !isNaN(Date.parse(value));
23
+ }
24
+ /**
25
+ * * Checks if the provided value is a valid time string in "HH:MM" format.
26
+ *
27
+ * @param value - The value to check.
28
+ * @returns `true` if the value is a valid time string, `false` otherwise.
29
+ */
30
+ function isValidTime(value) {
31
+ if (!require_primitives.isNonEmptyString(value)) return false;
32
+ const [hourStr, minuteStr] = value.split(":");
33
+ if (!require_utilities.isNumericString(hourStr) || !require_utilities.isNumericString(minuteStr)) return false;
34
+ const hour = Number(hourStr);
35
+ const minute = Number(minuteStr);
36
+ return hour >= 0 && hour <= 23 && minute >= 0 && minute <= 59;
37
+ }
38
+ /**
39
+ * * Checks if the provided value is a valid `UTCOffset` (e.g. `UTC-01:30`).
40
+ *
41
+ * @param value - The value to check.
42
+ * @returns `true` if the value is a valid utc offset, `false` otherwise.
43
+ */
44
+ function isValidUTCOffset(value) {
45
+ return require_primitives.isNonEmptyString(value) ? /^UTC[+-]?\d{1,2}:\d{2}$/.test(value) : false;
46
+ }
47
+ /**
48
+ * * Validates whether the provided value is a recognized IANA time zone identifier (excluding `"Factory"`), based on the {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones IANA TZ Database}.
49
+ *
50
+ * @remarks
51
+ * - Relies on a large constant map of time zone identifiers, which can increase bundle size in browser environments. Matches against `597` identifiers.
52
+ * - Prefer {@link isNativeTimeZoneId} when you want a lightweight, native-only validation approach. Matches against `418` identifiers.
53
+ *
54
+ * @param value Time zone identifier to validate.
55
+ * @returns `true` if the value is a valid IANA time zone identifier, otherwise `false`.
56
+ */
57
+ function isValidTimeZoneId(value) {
58
+ return require_primitives.isNonEmptyString(value) ? new Set([...require_timezone.IANA_TZ_IDS]).has(value) : false;
59
+ }
60
+ /**
61
+ * * Validates whether the provided value is a supported time zone identifier using the native JavaScript API (`Intl.supportedValuesOf('timeZone')`).
62
+ *
63
+ * @remarks
64
+ * - Uses only native {@link Intl} capabilities—minimal code footprint, highly performant. Matches against `418` identifiers.
65
+ * - Prefer {@link isValidTimeZoneId} when validation must align strictly with the full
66
+ * {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones IANA TZ Database}. Matches against `597` identifiers.
67
+ *
68
+ * @param value Time zone identifier to validate.
69
+ * @returns `true` if the value is a valid native JS-supported time zone identifier, otherwise `false`.
70
+ */
71
+ function isNativeTimeZoneId(value) {
72
+ return require_primitives.isNonEmptyString(value) ? new Set(require_timezone.NATIVE_TZ_IDS).has(value) : false;
73
+ }
74
+ /**
75
+ * * Checks if the year is a leap year.
76
+ *
77
+ * - A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400.
78
+ * - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not.
79
+ * @param year The year to check.
80
+ * @returns `true` if the year is a leap year, `false` otherwise.
81
+ */
82
+ function isLeapYear(year) {
83
+ const $year = require_utilities.normalizeNumber(year);
84
+ return $year ? $year % 4 === 0 && $year % 100 !== 0 || $year % 400 === 0 : false;
85
+ }
86
+ /**
87
+ * * Checks if a value is a date-like object from `Date`, `Chronos`, `Moment.js`, `Day.js`, `Luxon`, `JS-Joda`, or `Temporal`
88
+ * @param value Value to check if it is date-like object.
89
+ * @returns `true` if the value is date-like object, otherwise `false`.
90
+ */
91
+ function isDateLike(value) {
92
+ if (value instanceof Date) return true;
93
+ if (require_non_primitives.isObject(value)) {
94
+ if (require_non_primitives.isFunction(value.format) && require_non_primitives.isFunction(value.toJSON) && require_non_primitives.isFunction(value.toISOString)) return true;
95
+ if (require_non_primitives.isFunction(value.toISO) && require_non_primitives.isFunction(value.toFormat) && require_primitives.isBoolean(value.isValid)) return true;
96
+ if (require_non_primitives.isFunction(value.plus) && require_non_primitives.isFunction(value.minus) && require_non_primitives.isFunction(value.equals) && require_non_primitives.isFunction(value.getClass)) return true;
97
+ if (require_non_primitives.isFunction(value.toJSON) && require_non_primitives.isFunction(value.toString) && [
98
+ "PlainDate",
99
+ "ZonedDateTime",
100
+ "Instant"
101
+ ].includes(value.constructor?.name ?? "")) return true;
102
+ }
103
+ return false;
104
+ }
105
+ /** Checks if a value represents time value (number) with different forms of {@link TimeWithUnit units} */
106
+ function isTimeWithUnit(value) {
107
+ return require_primitives.isNonEmptyString(value) && /^-?\d*\.?\d+ *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.test(value);
108
+ }
109
+
110
+ //#endregion
111
+ exports.isDate = isDate;
112
+ exports.isDateLike = isDateLike;
113
+ exports.isDateString = isDateString;
114
+ exports.isLeapYear = isLeapYear;
115
+ exports.isNativeTimeZoneId = isNativeTimeZoneId;
116
+ exports.isTimeWithUnit = isTimeWithUnit;
117
+ exports.isValidTime = isValidTime;
118
+ exports.isValidTimeZoneId = isValidTimeZoneId;
119
+ exports.isValidUTCOffset = isValidUTCOffset;