chronos-date 1.0.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 (99) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +31 -0
  3. package/dist/basic-CKxaRSHQ.cjs +1 -0
  4. package/dist/basic-e46DaNAi.mjs +1 -0
  5. package/dist/constants.cjs +1 -0
  6. package/dist/constants.d.cts +2 -0
  7. package/dist/constants.d.mts +2 -0
  8. package/dist/constants.mjs +1 -0
  9. package/dist/convert-Bmp63ats.mjs +1 -0
  10. package/dist/convert-DrLrcgqz.cjs +1 -0
  11. package/dist/greet-BBsrvmkn.mjs +1 -0
  12. package/dist/greet-C-6mruI9.cjs +1 -0
  13. package/dist/guards.cjs +1 -0
  14. package/dist/guards.d.cts +71 -0
  15. package/dist/guards.d.mts +71 -0
  16. package/dist/guards.mjs +1 -0
  17. package/dist/helpers-DGzYnP81.cjs +1 -0
  18. package/dist/helpers-N1X_Rj_V.mjs +1 -0
  19. package/dist/index.cjs +1 -0
  20. package/dist/index.d.cts +3 -0
  21. package/dist/index.d.mts +3 -0
  22. package/dist/index.mjs +1 -0
  23. package/dist/non-primitives-B2EE6D6s.mjs +1 -0
  24. package/dist/non-primitives-Bu3a4WL4.cjs +1 -0
  25. package/dist/plugins/banglaPlugin.cjs +1 -0
  26. package/dist/plugins/banglaPlugin.d.cts +225 -0
  27. package/dist/plugins/banglaPlugin.d.mts +225 -0
  28. package/dist/plugins/banglaPlugin.mjs +1 -0
  29. package/dist/plugins/businessPlugin.cjs +1 -0
  30. package/dist/plugins/businessPlugin.d.cts +446 -0
  31. package/dist/plugins/businessPlugin.d.mts +446 -0
  32. package/dist/plugins/businessPlugin.mjs +1 -0
  33. package/dist/plugins/dateRangePlugin.cjs +1 -0
  34. package/dist/plugins/dateRangePlugin.d.cts +71 -0
  35. package/dist/plugins/dateRangePlugin.d.mts +71 -0
  36. package/dist/plugins/dateRangePlugin.mjs +1 -0
  37. package/dist/plugins/dayPartPlugin.cjs +1 -0
  38. package/dist/plugins/dayPartPlugin.d.cts +45 -0
  39. package/dist/plugins/dayPartPlugin.d.mts +45 -0
  40. package/dist/plugins/dayPartPlugin.mjs +1 -0
  41. package/dist/plugins/durationPlugin.cjs +1 -0
  42. package/dist/plugins/durationPlugin.d.cts +30 -0
  43. package/dist/plugins/durationPlugin.d.mts +30 -0
  44. package/dist/plugins/durationPlugin.mjs +1 -0
  45. package/dist/plugins/fromNowPlugin.cjs +1 -0
  46. package/dist/plugins/fromNowPlugin.d.cts +24 -0
  47. package/dist/plugins/fromNowPlugin.d.mts +24 -0
  48. package/dist/plugins/fromNowPlugin.mjs +1 -0
  49. package/dist/plugins/greetingPlugin.cjs +1 -0
  50. package/dist/plugins/greetingPlugin.d.cts +29 -0
  51. package/dist/plugins/greetingPlugin.d.mts +29 -0
  52. package/dist/plugins/greetingPlugin.mjs +1 -0
  53. package/dist/plugins/palindromePlugin.cjs +1 -0
  54. package/dist/plugins/palindromePlugin.d.cts +38 -0
  55. package/dist/plugins/palindromePlugin.d.mts +38 -0
  56. package/dist/plugins/palindromePlugin.mjs +1 -0
  57. package/dist/plugins/relativeTimePlugin.cjs +1 -0
  58. package/dist/plugins/relativeTimePlugin.d.cts +82 -0
  59. package/dist/plugins/relativeTimePlugin.d.mts +82 -0
  60. package/dist/plugins/relativeTimePlugin.mjs +1 -0
  61. package/dist/plugins/roundPlugin.cjs +1 -0
  62. package/dist/plugins/roundPlugin.d.cts +29 -0
  63. package/dist/plugins/roundPlugin.d.mts +29 -0
  64. package/dist/plugins/roundPlugin.mjs +1 -0
  65. package/dist/plugins/seasonPlugin.cjs +1 -0
  66. package/dist/plugins/seasonPlugin.d.cts +26 -0
  67. package/dist/plugins/seasonPlugin.d.mts +26 -0
  68. package/dist/plugins/seasonPlugin.mjs +1 -0
  69. package/dist/plugins/timeZonePlugin.cjs +1 -0
  70. package/dist/plugins/timeZonePlugin.d.cts +88 -0
  71. package/dist/plugins/timeZonePlugin.d.mts +88 -0
  72. package/dist/plugins/timeZonePlugin.mjs +1 -0
  73. package/dist/plugins/zodiacPlugin.cjs +1 -0
  74. package/dist/plugins/zodiacPlugin.d.cts +41 -0
  75. package/dist/plugins/zodiacPlugin.d.mts +41 -0
  76. package/dist/plugins/zodiacPlugin.mjs +1 -0
  77. package/dist/primitives-Cxss_JVF.mjs +1 -0
  78. package/dist/primitives-Db2FUp4e.cjs +1 -0
  79. package/dist/seasons-ChAIVphi.mjs +1 -0
  80. package/dist/seasons-CioTH5Dm.d.mts +5285 -0
  81. package/dist/seasons-CsVeJ27s.d.cts +5285 -0
  82. package/dist/seasons-oABOhHcX.cjs +1 -0
  83. package/dist/timezone-B10UItNO.mjs +1 -0
  84. package/dist/timezone-CWxbK_7I.cjs +1 -0
  85. package/dist/types-B2fgrJ86.d.mts +2123 -0
  86. package/dist/types-DPTQ_yLx.d.cts +2123 -0
  87. package/dist/types.cjs +0 -0
  88. package/dist/types.d.cts +2 -0
  89. package/dist/types.d.mts +2 -0
  90. package/dist/types.mjs +1 -0
  91. package/dist/utilities-B8dOAQVD.cjs +1 -0
  92. package/dist/utilities-BJE06bms.mjs +1 -0
  93. package/dist/utilities-D2-p26DX.cjs +1 -0
  94. package/dist/utilities-DV_ohS37.mjs +1 -0
  95. package/dist/utils.cjs +1 -0
  96. package/dist/utils.d.cts +188 -0
  97. package/dist/utils.d.mts +188 -0
  98. package/dist/utils.mjs +1 -0
  99. package/package.json +162 -0
@@ -0,0 +1,2123 @@
1
+ import { A as MILLISECOND_FORMATS, B as ZODIAC_PRESETS, C as DATE_PARTS, D as INTERNALS, E as HOUR_FORMATS, F as TIME_FORMATS, I as TIME_UNIT_VARIANTS, M as MONTHS, N as MONTH_FORMATS, O as LOCALE_CALENDARS, P as SECOND_FORMATS, R as WESTERN_ZODIAC_SIGNS, S as DATE_FORMATS, T as DAY_FORMATS, _ as TIME_ZONE_LABELS, b as BN_MONTH_TABLES, g as TIME_ZONE_IDS, h as TIME_ZONES_NATIVE, j as MINUTE_FORMATS, k as LOCALE_NUMBERING_SYSTEMS, m as TIME_ZONES, u as SEASON_PRESETS, v as BN_DAYS, w as DAYS, x as BN_SEASONS, y as BN_MONTHS, z as YEAR_FORMATS } from "./seasons-CioTH5Dm.mjs";
2
+
3
+ //#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/dts/utils/types.d.ts
4
+ /**
5
+ * * Broadens a literal union (typically `string` or `number`) to also accept any other value of the base type, without losing IntelliSense autocomplete for the provided literals.
6
+ *
7
+ * *This is especially useful in API design where you want to provide suggestions for common options but still allow flexibility for custom user-defined values.*
8
+ *
9
+ * @example
10
+ * // ✅ String literal usage
11
+ * type Variant = LooseLiteral<'primary' | 'secondary'>;
12
+ * const v1: Variant = 'primary'; // suggested
13
+ * const v2: Variant = 'custom'; // also valid
14
+ *
15
+ * // ✅ Number literal usage
16
+ * type StatusCode = LooseLiteral<200 | 404 | 500>;
17
+ * const s1: StatusCode = 200; // suggested
18
+ * const s2: StatusCode = 999; // also valid
19
+ *
20
+ * // ✅ Mixed literal
21
+ * type Mixed = LooseLiteral<'one' | 2>;
22
+ * const m1: Mixed = 'one'; // ✅
23
+ * const m2: Mixed = 2; // ✅
24
+ * const m3: Mixed = 'anything'; // ✅
25
+ * const m4: Mixed = 123; // ✅
26
+ *
27
+ * @note Technically, this uses intersection with primitive base types (`string & {}` or `number & {}`) to retain IntelliSense while avoiding type narrowing.
28
+ */
29
+ type LooseLiteral<T extends string | number> = T | (T extends string ? string & {} : number & {});
30
+ /** Internal helper type to build a tuple of length N. */
31
+ type $TupleOf<T, N extends number, R extends unknown[] = []> = R['length'] extends N ? R : $TupleOf<T, N, [...R, T]>;
32
+ /**
33
+ * * Creates a tuple type of a given length with elements of type T
34
+ *
35
+ * 📝 **Notes**:
36
+ * - This works recursively to build a tuple of exact length N.
37
+ *
38
+ * - N must be a literal number, not just number. You can’t pass a general number type because recursion can't compute unbounded lengths
39
+ * - You can use as const or mapped types when initializing values with this shape
40
+ *
41
+ * @example
42
+ * type FiveStrings = TupleOf<string, 5>; // [string, string, string, string, string]
43
+ * type EmptyTuple = TupleOf<boolean, 0>; // []
44
+ */
45
+ type TupleOf<T, N extends number> = $TupleOf<T, N>;
46
+ /** * Build a tuple of given length (helper for type-level arithmetic). */
47
+ type $BuildTuple<L extends number, T extends unknown[] = []> = T['length'] extends L ? T : $BuildTuple<L, [...T, unknown]>;
48
+ /** * Produce a union of numbers `From | From+1 | ... | To`. */
49
+ type $Range<From extends number, To extends number, Arr extends unknown[] = $BuildTuple<From>, Result = never> = Arr['length'] extends To ? Result | To : $Range<From, To, [...Arr, unknown], Result | Arr['length']>;
50
+ /**
51
+ * * Creates a tuple with length between `Min` and `Max` (inclusive).
52
+ *
53
+ * @example
54
+ * type Ranged = RangeTuple<string, 2, 4>;
55
+ * // Ranged -> [string, string] | [string, string, string] | [string, string, string, string]
56
+ */
57
+ type RangeTuple<T, Min extends number, Max extends number> = $Range<Min, Max> extends infer N ? (N extends number ? TupleOf<T, N> : never) : never;
58
+ /**
59
+ * * Cast one type to another while preserving compatibility.
60
+ *
61
+ * @remarks
62
+ * - Ensures that `A1` extends `A2`. If not, falls back to `A2`.
63
+ * - Useful for enforcing constraints on generics or parameters.
64
+ *
65
+ * @param A1 - Type to check.
66
+ * @param A2 - Type to cast to.
67
+ * @returns `A1` if it extends `A2`, otherwise `A2`.
68
+ *
69
+ * @example
70
+ * type T0 = Cast<'42', string>; // '42'
71
+ * type T1 = Cast<'42', number>; // number
72
+ * type T2 = Cast<42, number>; // 42
73
+ */
74
+ type Cast<A1, A2> = A1 extends A2 ? A1 : A2;
75
+ /**
76
+ * * Remove the last element of a list (array).
77
+ *
78
+ * @remarks Produces a new tuple/list type with the last element removed.
79
+ *
80
+ * @example
81
+ * type T0 = Pop<[1, 2, 3]>; // [1, 2]
82
+ * type T1 = Pop<[]>; // []
83
+ * type T2 = Pop<['a']>; // []
84
+ */
85
+ type Pop<L extends List> = L extends readonly [...infer El, any] | readonly [...infer El, any?] ? El : L;
86
+ type _Split<S extends string, D extends string, T extends string[] = []> = S extends `${infer BS}${D}${infer AS}` ? _Split<AS, D, [...T, BS]> : [...T, S];
87
+ type $Split<S extends string, D extends string = ''> = D extends '' ? Pop<_Split<S, D>> : _Split<S, D>;
88
+ /**
89
+ * ✂️ Split a string literal by a given delimiter into a list of strings.
90
+ *
91
+ * @remarks
92
+ * Produces a tuple of substrings by splitting `S` at each occurrence of `D`.
93
+ *
94
+ * @param S - String literal to split.
95
+ * @param D - Delimiter to split on (default: empty string, i.e., character split).
96
+ * @returns A list of string literals.
97
+ *
98
+ * @example
99
+ * type T0 = Split<'a,b,c', ','>; // ['a', 'b', 'c']
100
+ * type T1 = Split<'hello', ''>; // ['h', 'e', 'l', 'l', 'o']
101
+ * type T2 = Split<'foo-bar', '-'>; // ['foo', 'bar']
102
+ */
103
+ type Split<S extends string, D extends string = ''> = $Split<S, D> extends infer X ? Cast<X, string[]> : never;
104
+ /**
105
+ * Recursively join the string S for each element in the tuple A.
106
+ * Returns an empty string for an empty tuple.
107
+ */
108
+ type $JoinRepeat<S extends string, A extends unknown[]> = A extends [unknown, ...infer Rest] ? `${S}${$JoinRepeat<S, Rest>}` : '';
109
+ /**
110
+ * * Repeat string `S`, `N` times.
111
+ *
112
+ * @example
113
+ * type L10 = Repeat<'l', 10>; // "llllllllll"
114
+ *
115
+ * type AB3 = Repeat<'a' | 'b', 3>; // "aab" | "aaa" | "aba" | "abb" | "bab" | "baa" | "bba" | "bbb"
116
+ *
117
+ * @remarks **Limitations:**
118
+ * - `N` must be a literal number.
119
+ * - If `S` is a union (e.g. 'a' | 'b'), the resulting union grows exponentially with `N`.
120
+ */
121
+ type Repeat<S extends string, N extends number> = $JoinRepeat<S, $BuildTuple<N>>;
122
+ //#endregion
123
+ //#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/dts/number/constants.d.ts
124
+ /** List of all supported BCP 47 locales */
125
+ declare const LOCALE_CODES: readonly ["af-ZA", "am-ET", "ar-AE", "ar-BH", "ar-DZ", "ar-EG", "ar-IQ", "ar-JO", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-OM", "ar-QA", "ar-SA", "ar-SD", "ar-SY", "ar-TN", "ar-YE", "az-AZ", "be-BY", "bg-BG", "bn-BD", "bn-IN", "bs-BA", "ca-ES", "cs-CZ", "cy-GB", "da-DK", "de-AT", "de-CH", "de-DE", "el-GR", "en-AU", "en-CA", "en-GB", "en-IE", "en-IN", "en-NZ", "en-PH", "en-SG", "en-US", "en-ZA", "es-AR", "es-BO", "es-CL", "es-CO", "es-CR", "es-DO", "es-EC", "es-ES", "es-GT", "es-HN", "es-MX", "es-NI", "es-PA", "es-PE", "es-PR", "es-PY", "es-SV", "es-US", "es-UY", "es-VE", "et-EE", "eu-ES", "fa-IR", "fi-FI", "fil-PH", "fr-BE", "fr-CA", "fr-CH", "fr-FR", "ga-IE", "gl-ES", "gu-IN", "he-IL", "hi-IN", "hr-HR", "hu-HU", "hy-AM", "id-ID", "is-IS", "it-CH", "it-IT", "ja-JP", "ka-GE", "kk-KZ", "km-KH", "kn-IN", "ko-KR", "ky-KG", "lt-LT", "lv-LV", "mk-MK", "ml-IN", "mn-MN", "mr-IN", "ms-MY", "mt-MT", "nb-NO", "ne-NP", "nl-BE", "nl-NL", "pl-PL", "pt-BR", "pt-PT", "ro-RO", "ru-RU", "sk-SK", "sl-SI", "sq-AL", "sr-Latn", "sv-SE", "sw-KE", "ta-IN", "te-IN", "th-TH", "tr-TR", "uk-UA", "ur-PK", "uz-UZ", "vi-VN", "zh-CN", "zh-HK", "zh-TW"];
126
+ /** Mapping of CurrencyCodes to `LocaleCodes` */
127
+ declare const CURRENCY_LOCALES: Readonly<{
128
+ readonly AED: "ar-AE";
129
+ readonly AFN: "fa-IR";
130
+ readonly ALL: "sq-AL";
131
+ readonly AMD: "hy-AM";
132
+ readonly ANG: "nl-NL";
133
+ readonly AOA: "pt-AO";
134
+ readonly ARS: "es-AR";
135
+ readonly AUD: "en-AU";
136
+ readonly AWG: "nl-AW";
137
+ readonly AZN: "az-AZ";
138
+ readonly BAM: "bs-BA";
139
+ readonly BBD: "en-BB";
140
+ readonly BDT: "bn-BD";
141
+ readonly BGN: "bg-BG";
142
+ readonly BHD: "ar-BH";
143
+ readonly BIF: "fr-BI";
144
+ readonly BMD: "en-BM";
145
+ readonly BND: "ms-BN";
146
+ readonly BOB: "es-BO";
147
+ readonly BRL: "pt-BR";
148
+ readonly BSD: "en-BS";
149
+ readonly BTN: "dz-BT";
150
+ readonly BWP: "en-BW";
151
+ readonly BYN: "be-BY";
152
+ readonly BZD: "es-BZ";
153
+ readonly CAD: "fr-CA";
154
+ readonly CDF: "fr-CD";
155
+ readonly CHF: "fr-CH";
156
+ readonly CLP: "es-CL";
157
+ readonly CNY: "zh-CN";
158
+ readonly COP: "es-CO";
159
+ readonly CRC: "es-CR";
160
+ readonly CUP: "es-CU";
161
+ readonly CVE: "pt-CV";
162
+ readonly CZK: "cs-CZ";
163
+ readonly DJF: "fr-DJ";
164
+ readonly DKK: "da-DK";
165
+ readonly DOP: "es-DO";
166
+ readonly DZD: "ar-DZ";
167
+ readonly EGP: "ar-EG";
168
+ readonly ERN: "ti-ER";
169
+ readonly ETB: "am-ET";
170
+ readonly EUR: "de-DE";
171
+ readonly FJD: "en-FJ";
172
+ readonly FKP: "en-FK";
173
+ readonly FOK: "fo-FO";
174
+ readonly GBP: "en-GB";
175
+ readonly GEL: "ka-GE";
176
+ readonly GGP: "en-GG";
177
+ readonly GHS: "ak-GH";
178
+ readonly GIP: "en-GI";
179
+ readonly GMD: "en-GM";
180
+ readonly GNF: "fr-GN";
181
+ readonly GTQ: "es-GT";
182
+ readonly GYD: "en-GY";
183
+ readonly HKD: "zh-HK";
184
+ readonly HNL: "es-HN";
185
+ readonly HRK: "hr-HR";
186
+ readonly HTG: "ht-HT";
187
+ readonly HUF: "hu-HU";
188
+ readonly IDR: "id-ID";
189
+ readonly ILS: "he-IL";
190
+ readonly IMP: "en-IM";
191
+ readonly INR: "hi-IN";
192
+ readonly IQD: "ar-IQ";
193
+ readonly IRR: "fa-IR";
194
+ readonly ISK: "is-IS";
195
+ readonly JEP: "en-JE";
196
+ readonly JMD: "en-JM";
197
+ readonly JOD: "ar-JO";
198
+ readonly JPY: "ja-JP";
199
+ readonly KES: "sw-KE";
200
+ readonly KGS: "ky-KG";
201
+ readonly KHR: "km-KH";
202
+ readonly KID: "en-KI";
203
+ readonly KMF: "fr-KM";
204
+ readonly KRW: "ko-KR";
205
+ readonly KWD: "ar-KW";
206
+ readonly KYD: "en-KY";
207
+ readonly KZT: "kk-KZ";
208
+ readonly LAK: "lo-LA";
209
+ readonly LBP: "ar-LB";
210
+ readonly LKR: "si-LK";
211
+ readonly LRD: "en-LR";
212
+ readonly LSL: "st-LS";
213
+ readonly LYD: "ar-LY";
214
+ readonly MAD: "ar-MA";
215
+ readonly MDL: "ro-RO";
216
+ readonly MGA: "mg-MG";
217
+ readonly MKD: "mk-MK";
218
+ readonly MMK: "my-MM";
219
+ readonly MNT: "mn-MN";
220
+ readonly MOP: "pt-MO";
221
+ readonly MRU: "ar-MA";
222
+ readonly MUR: "en-MU";
223
+ readonly MVR: "dv-MV";
224
+ readonly MWK: "ny-MW";
225
+ readonly MXN: "es-MX";
226
+ readonly MYR: "ms-MY";
227
+ readonly MZN: "pt-MZ";
228
+ readonly NAD: "en-NA";
229
+ readonly NGN: "en-NG";
230
+ readonly NIO: "es-NI";
231
+ readonly NOK: "no-NO";
232
+ readonly NPR: "ne-NP";
233
+ readonly NZD: "en-NZ";
234
+ readonly OMR: "ar-OM";
235
+ readonly PAB: "es-PA";
236
+ readonly PEN: "es-PE";
237
+ readonly PGK: "en-PG";
238
+ readonly PHP: "fil-PH";
239
+ readonly PKR: "ur-PK";
240
+ readonly PLN: "pl-PL";
241
+ readonly PYG: "es-PY";
242
+ readonly QAR: "ar-QA";
243
+ readonly RON: "ro-RO";
244
+ readonly RSD: "sr-RS";
245
+ readonly RUB: "ru-RU";
246
+ readonly RWF: "rw-RW";
247
+ readonly SAR: "ar-SA";
248
+ readonly SBD: "en-SB";
249
+ readonly SCR: "en-SC";
250
+ readonly SDG: "ar-SD";
251
+ readonly SEK: "sv-SE";
252
+ readonly SGD: "en-SG";
253
+ readonly SHP: "en-SH";
254
+ readonly SLE: "en-SL";
255
+ readonly SOS: "so-SO";
256
+ readonly SRD: "nl-SR";
257
+ readonly SSP: "en-SS";
258
+ readonly STN: "st-ST";
259
+ readonly SYP: "ar-SY";
260
+ readonly SZL: "en-SZ";
261
+ readonly THB: "th-TH";
262
+ readonly TJS: "tg-TJ";
263
+ readonly TMT: "tk-TM";
264
+ readonly TND: "ar-TN";
265
+ readonly TOP: "to-TO";
266
+ readonly TRY: "tr-TR";
267
+ readonly TTD: "en-TT";
268
+ readonly TVD: "en-TV";
269
+ readonly TWD: "zh-TW";
270
+ readonly TZS: "sw-TZ";
271
+ readonly UAH: "uk-UA";
272
+ readonly UGX: "sw-UG";
273
+ readonly USD: "en-US";
274
+ readonly UYU: "es-UY";
275
+ readonly UZS: "uz-UZ";
276
+ readonly VES: "ve-VE";
277
+ readonly VND: "vi-VN";
278
+ readonly VUV: "en-VU";
279
+ readonly WST: "en-WS";
280
+ readonly YER: "ar-YE";
281
+ readonly ZAR: "en-ZA";
282
+ readonly ZMW: "en-ZM";
283
+ readonly ZWL: "en-ZW";
284
+ }>;
285
+ /** * Bangla digits from `০-৯` mapped against `0-9` */
286
+ declare const BN_DIGITS: Readonly<{
287
+ readonly '\u09E6': 0;
288
+ readonly '\u09E7': 1;
289
+ readonly '\u09E8': 2;
290
+ readonly '\u09E9': 3;
291
+ readonly '\u09EA': 4;
292
+ readonly '\u09EB': 5;
293
+ readonly '\u09EC': 6;
294
+ readonly '\u09ED': 7;
295
+ readonly '\u09EE': 8;
296
+ readonly '\u09EF': 9;
297
+ }>;
298
+ //#endregion
299
+ //#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/dts/number/types.d.ts
300
+ /** Enumerate & Enumerate Internal: builds a union of all numbers from 0 to N - 1 */
301
+ type $EnumerateInternal<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : $EnumerateInternal<N, [...Acc, Acc['length']]>;
302
+ /**
303
+ * * Builds a union of numeric literals from `0` to `N - 1`.
304
+ *
305
+ * @remarks
306
+ * - This utility supports ranges up to 998 due to TypeScript recursion limits.
307
+ *
308
+ * @example
309
+ * type U = Enumerate<3>; // 0 | 1 | 2
310
+ */
311
+ type Enumerate<N extends number> = $EnumerateInternal<N>;
312
+ /** Helper: Add 1 to a number */
313
+ type $AddOne<N extends number, Acc extends unknown[] = []> = Acc['length'] extends N ? [...Acc, unknown]['length'] : $AddOne<N, [...Acc, unknown]>;
314
+ /**
315
+ *
316
+ * * Creates a union type of all numeric literals starting from `From` up to `To`.
317
+ *
318
+ * @example
319
+ * type R = NumberRange<2, 5>; // 2 | 3 | 4 5
320
+ * type N = NumberRange<0, 998>; // 0 | 1 | 2 | ... | 998
321
+ *
322
+ * @remarks
323
+ * - This utility supports ranges up to 998 due to TypeScript recursion limits.
324
+ * - `From` and `To` both are inclusive, — so `NumberRange<0, 998>` generates `0` to `998`.
325
+ * - Result is a union type, not a tuple or array.
326
+ *
327
+ * @generic From - A number from 0-998, start of the range.
328
+ * @generic To - A number from 1-998, end of the range.
329
+ * @returns A union of numeric literal types from `From` to `To - 1`.
330
+ */
331
+ type NumberRange<From extends number, To extends number> = Exclude<Enumerate<$AddOne<To>>, Enumerate<From>>;
332
+ /** - List of all supported BCP 47 locales */
333
+ type LocaleCode = (typeof CURRENCY_LOCALES)[keyof typeof CURRENCY_LOCALES] | (typeof LOCALE_CODES)[number];
334
+ /** Bangla digits from `০-৯` */
335
+ type BanglaDigit = keyof typeof BN_DIGITS;
336
+ /** Bangla digits from `১-৯` */
337
+ type $BnOnes = Exclude<BanglaDigit, '০'>;
338
+ //#endregion
339
+ //#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/dts/types/index.d.ts
340
+ /** Represents a value that may or may not be present. */
341
+ type Maybe<T> = T | undefined;
342
+ /** Union of `number` and numeric string */
343
+ type Numeric = number | `${number}`;
344
+ /**
345
+ * * A readonly array of elements of type `T`.
346
+ *
347
+ * @remarks
348
+ * - Shorthand for `ReadonlyArray<T>`. Used to represent immutable lists.
349
+ *
350
+ * @example
351
+ * type Numbers = List<number>; // readonly number[]
352
+ * const arr: Numbers = [1, 2, 3]; // ✅ OK
353
+ * arr.push(4); // ❌ Error (readonly)
354
+ */
355
+ type List<T = any> = ReadonlyArray<T>;
356
+ //#endregion
357
+ //#region src/types/format-tokens.d.ts
358
+ /** Year in either 4 or 2 digits format */
359
+ type YearToken = (typeof YEAR_FORMATS)[number];
360
+ /** Month in either 1 or 2 digits or 3 letters or full word format */
361
+ type MonthToken = (typeof MONTH_FORMATS)[number];
362
+ /** Day in either 2 letters or full word format */
363
+ type DayToken = (typeof DAY_FORMATS)[number];
364
+ /** Date in either 1 or 2 digits format */
365
+ type DateToken = (typeof DATE_FORMATS)[number];
366
+ /** Second in either 1 or 2 digits format */
367
+ type HourToken = (typeof HOUR_FORMATS)[number];
368
+ /** Second in either 1 or 2 digits format */
369
+ type MinuteToken = (typeof MINUTE_FORMATS)[number];
370
+ /** Second in either 1 or 2 digits format */
371
+ type SecondToken = (typeof SECOND_FORMATS)[number];
372
+ /** Millisecond in either 1 or 2 digits format */
373
+ type MSToken = (typeof MILLISECOND_FORMATS)[number];
374
+ /** Time formats in either capital or lowercase `am/pm` format */
375
+ type TimeToken = (typeof TIME_FORMATS)[number];
376
+ /** Standard date/time format tokens for `Chronos`. */
377
+ type FormatToken = YearToken | MonthToken | DayToken | DateToken | HourToken | MinuteToken | SecondToken | MSToken | TimeToken | 'Z' | 'ZZ';
378
+ /** Standard date formats. */
379
+ type DateFormatToken = `${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>}` | `${Exclude<MonthToken, 'M' | 'MM'>} ${DateToken}` | `${DayToken}, ${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>}` | `${DayToken}, ${Exclude<MonthToken, 'M' | 'MM'>} ${DateToken}` | `${Exclude<MonthToken, 'M' | 'MM'>} ${DateToken}, ${YearToken}` | `${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>}, ${YearToken}` | `${Exclude<MonthToken, 'M' | 'MM'>} ${DateToken} ${YearToken}` | `${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>} ${YearToken}` | `${DayToken}, ${Exclude<MonthToken, 'M' | 'MM'>} ${DateToken}, ${YearToken}` | `${DayToken}, ${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>}, ${YearToken}` | `${DayToken}, ${Exclude<MonthToken, 'M' | 'MM'>} ${DateToken} ${YearToken}` | `${DayToken}, ${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>} ${YearToken}` | `${Exclude<DateToken, 'Do'>}.${Exclude<MonthToken, 'mmm' | 'mmmm'>}.${YearToken}` | `${YearToken}.${Exclude<MonthToken, 'mmm' | 'mmmm'>}.${Exclude<DateToken, 'Do'>}` | `${Exclude<DateToken, 'Do'>}/${Exclude<MonthToken, 'mmm' | 'mmmm'>}/${YearToken}` | `${Exclude<DateToken, 'Do'>}-${Exclude<MonthToken, 'mmm' | 'mmmm'>}-${YearToken}` | `${Exclude<MonthToken, 'mmm' | 'mmmm'>}/${Exclude<DateToken, 'Do'>}/${YearToken}` | `${Exclude<MonthToken, 'mmm' | 'mmmm'>}-${Exclude<DateToken, 'Do'>}-${YearToken}` | `${YearToken}-${Exclude<MonthToken, 'mmm' | 'mmmm'>}-${Exclude<DateToken, 'Do'>}` | `${YearToken}/${Exclude<MonthToken, 'mmm' | 'mmmm'>}/${Exclude<DateToken, 'Do'>}` | `${YearToken}-${Exclude<DateToken, 'Do'>}-${Exclude<MonthToken, 'mmm' | 'mmmm'>}` | `${YearToken}/${Exclude<DateToken, 'Do'>}/${Exclude<MonthToken, 'mmm' | 'mmmm'>}`;
380
+ /** Standard Time Formats */
381
+ type TimeFormatToken = `${Exclude<HourToken, 'h' | 'hh' | 'H'>}:${Exclude<MinuteToken, 'm'>}` | `${Exclude<HourToken, 'H' | 'HH' | 'h'>}:${Exclude<MinuteToken, 'm'>} ${TimeToken}` | `${Exclude<HourToken, 'h' | 'hh' | 'H'>}:${Exclude<MinuteToken, 'm'>}:${Exclude<SecondToken, 's'>}` | `${Exclude<HourToken, 'H' | 'HH' | 'h'>}:${Exclude<MinuteToken, 'm'>}:${Exclude<SecondToken, 's'>} ${TimeToken}` | `${Exclude<HourToken, 'h' | 'hh' | 'H'>}:${Exclude<MinuteToken, 'm'>}:${Exclude<SecondToken, 's'>}:${Exclude<MSToken, 'ms'>}` | `${Exclude<HourToken, 'H' | 'HH' | 'h'>}:${Exclude<MinuteToken, 'm'>}:${Exclude<SecondToken, 's'>}:${Exclude<MSToken, 'ms'>} ${TimeToken}`;
382
+ type DateTimeISO = 'YYYY-MM-DDTHH:mm:ss.mssZZ';
383
+ type TokenConnector = ' ' | ', ' | '; ' | ' - ';
384
+ /** Format tokens for time only string */
385
+ type TimeOnlyFormat = LooseLiteral<TimeFormatToken>;
386
+ /** Pre-defined literal types for formatting date and time. Optionally can pass any string. */
387
+ type StrictFormat = LooseLiteral<DateTimeISO | DateFormatToken | TimeFormatToken | `${DateFormatToken}${TokenConnector}${TimeFormatToken}`>;
388
+ //#endregion
389
+ //#region src/types/bangla-date.d.ts
390
+ type $BnEn = 'bn' | 'en';
391
+ type $BnOnesPadded = `০${$BnOnes}`;
392
+ /** Bangla month from `১-১২` */
393
+ type BanglaMonth = $BnOnes | $BnOnesPadded | '১০' | '১১' | '১২';
394
+ /** Bangla date of month from `১-৩১` */
395
+ type BanglaDate = $BnOnes | $BnOnesPadded | `১${BanglaDigit}` | `২${BanglaDigit}` | '৩০' | '৩১';
396
+ type $BnYearPadded = Repeat<BanglaDigit, 4>;
397
+ type $BnMonthPadded = $BnOnesPadded | '১০' | '১১' | '১২';
398
+ type $BnDatePadded = $BnOnesPadded | `১${BanglaDigit}` | `২${BanglaDigit}` | '৩০' | '৩১';
399
+ /** Bangla year from `০-৯৯৯৯` */
400
+ type BanglaYear = BanglaDigit | `${$BnOnes}${BanglaDigit}` | `${$BnOnes}${BanglaDigit}${BanglaDigit}` | Repeat<BanglaDigit, 4>;
401
+ /** Token for Bangla season format */
402
+ type $SeasonToken = 'S' | 'SS';
403
+ /** Standard format tokens for Bangla date with seasons */
404
+ type DateWithSeasonToken = `${Exclude<MonthToken, 'M' | 'MM'>} ${DateToken}, ${YearToken} ${$SeasonToken}` | `${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>}, ${YearToken} ${$SeasonToken}` | `${Exclude<MonthToken, 'M' | 'MM'>} ${DateToken} ${YearToken} ${$SeasonToken}` | `${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>} ${YearToken} ${$SeasonToken}` | `${DayToken}, ${Exclude<MonthToken, 'M' | 'MM'>} ${DateToken}, ${YearToken}, ${$SeasonToken}` | `${DayToken}, ${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>}, ${YearToken}, ${$SeasonToken}` | `${DayToken}, ${Exclude<MonthToken, 'M' | 'MM'>} ${DateToken} ${YearToken}, ${$SeasonToken}` | `${DayToken}, ${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>} ${YearToken}, ${$SeasonToken}` | `${Exclude<DateToken, 'Do'>}/${Exclude<MonthToken, 'mmm' | 'mmmm'>}/${YearToken} (${$SeasonToken})` | `${Exclude<DateToken, 'Do'>}-${Exclude<MonthToken, 'mmm' | 'mmmm'>}-${YearToken} (${$SeasonToken})` | `${Exclude<MonthToken, 'mmm' | 'mmmm'>}/${Exclude<DateToken, 'Do'>}/${YearToken} (${$SeasonToken})` | `${Exclude<MonthToken, 'mmm' | 'mmmm'>}-${Exclude<DateToken, 'Do'>}-${YearToken} (${$SeasonToken})` | `${YearToken}-${Exclude<MonthToken, 'mmm' | 'mmmm'>}-${Exclude<DateToken, 'Do'>} (${$SeasonToken})` | `${YearToken}/${Exclude<MonthToken, 'mmm' | 'mmmm'>}/${Exclude<DateToken, 'Do'>} (${$SeasonToken})` | `${YearToken}-${Exclude<DateToken, 'Do'>}-${Exclude<MonthToken, 'mmm' | 'mmmm'>} (${$SeasonToken})` | `${YearToken}/${Exclude<DateToken, 'Do'>}/${Exclude<MonthToken, 'mmm' | 'mmmm'>} (${$SeasonToken})`;
405
+ /** Standard format tokens for Bangla date along with any string */
406
+ type BanglaDateFormat = LooseLiteral<DateFormatToken | DateWithSeasonToken>;
407
+ /** Bangla name of the weekday either in Bangla or Latin */
408
+ type BanglaDayName<Locale extends $BnEn = 'bn'> = (typeof BN_DAYS)[number][Locale];
409
+ /** Bangla name of the month either in Bangla or Latin */
410
+ type BanglaMonthName<Locale extends $BnEn = 'bn'> = (typeof BN_MONTHS)[number][Locale];
411
+ /** Bangla name of the season either in Bangla or Latin */
412
+ type BanglaSeasonName<Locale extends $BnEn = 'bn'> = (typeof BN_SEASONS)[number][Locale];
413
+ /** Represents Bangla year either in Bangla digit or Latin from 1-12 */
414
+ type $BanglaYear<Locale extends $BnEn = 'bn'> = Locale extends 'en' ? number : BanglaYear;
415
+ /** Represents Bangla month either in Bangla digit or Latin from 0-9999 */
416
+ type $BanglaMonth<Locale extends $BnEn = 'bn'> = Locale extends 'en' ? NumberRange<1, 12> : BanglaMonth;
417
+ /** Represents Bangla date of the month either in Bangla digit or Latin from 1-31 */
418
+ type $BanglaMonthDate<Locale extends $BnEn = 'bn'> = Locale extends 'en' ? NumberRange<1, 31> : BanglaDate;
419
+ /** Represents a Bangla date object for `Chronos` plugin */
420
+ type BanglaDateObject<Locale extends $BnEn = 'bn'> = {
421
+ /** Represents Bangla year either in Bangla digit or Latin from 1-12 */year: $BanglaYear<Locale>; /** Represents Bangla month either in Bangla digit or Latin from 1-12 */
422
+ month: $BanglaMonth<Locale>; /** Represents Bangla date of the month either in Bangla digit or Latin from 1-31 */
423
+ date: $BanglaMonthDate<Locale>; /** Bangla name of the weekday either in Bangla or Latin */
424
+ dayName: BanglaDayName<Locale>; /** Bangla name of the month either in Bangla or Latin */
425
+ monthName: BanglaMonthName<Locale>; /** Bangla name of the season either in Bangla or Latin */
426
+ seasonName: BanglaSeasonName<Locale>; /** Leap year status of the current year */
427
+ isLeapYear: boolean;
428
+ };
429
+ /** Variant of Bangla calendar system */
430
+ type BnCalendarVariant = keyof typeof BN_MONTH_TABLES;
431
+ /** Configuration object for Bangla Calendar system */
432
+ interface BnCalendarConfig {
433
+ /** - Calendar variant to use. Defaults to `'revised-2019'`. */
434
+ variant?: BnCalendarVariant;
435
+ }
436
+ /** Bangla date options for `Chronos` plugin (`banglaPlugin`) */
437
+ interface BanglaDateOptions<Locale extends $BnEn> extends BnCalendarConfig {
438
+ /** - Locale to use for output values. Defaults to `'bn'`. */
439
+ locale?: Locale | $BnEn;
440
+ }
441
+ //#endregion
442
+ //#region src/utils/chronos-fn.d.ts
443
+ /**
444
+ * * Use `chronos` with all static methods from the `Chronos` class.
445
+ *
446
+ * @description
447
+ * It serves as both a constructor for creating `Chronos` instances and a namespace for accessing all static methods from the `Chronos` class.
448
+ *
449
+ * **Note**: *If a date is provided **without a time component**, the instance will default to `00:00:00.000` UTC and convert it to the **equivalent local time** using the current environment's UTC offset.*
450
+ *
451
+ * @example
452
+ * // Example usage as constructor:
453
+ * const instance = chronos("2023-12-31");
454
+ * const instanceWithTime = chronos(2023, 12, 31, 15, 30, 0);
455
+ *
456
+ * @example
457
+ * // Example usage of static methods:
458
+ * // Both work identically - thanks to automatic Proxy delegation
459
+ * chronos.parse("2023-12-31", "YYYY-MM-DD");
460
+ * Chronos.parse("2023-12-31", "YYYY-MM-DD");
461
+ *
462
+ * chronos.today();
463
+ * chronos.isLeapYear(2024);
464
+ * chronos.min(date1, date2, date3);
465
+ *
466
+ * @remarks *No need to call `chronos` for accessing the static methods. Simply call the static methods.*
467
+ *
468
+ * **Available Static Methods:**
469
+ *
470
+ * ```ts
471
+ * chronos.now(): number;
472
+ * chronos.tomorrow(): Chronos;
473
+ * chronos.yesterday(): Chronos;
474
+ * chronos.today(options?: FormatOptions): string;
475
+ * chronos.with(options: ChronosWithOptions): Chronos;
476
+ * chronos.parse(dateStr: string, format: string): Chronos;
477
+ * chronos.utc(dateLike: ChronosInput): Chronos;
478
+ * chronos.min(...dates: ChronosInput[]): Chronos;
479
+ * chronos.max(...dates: ChronosInput[]): Chronos;
480
+ * chronos.isLeapYear(date: ChronosInput): boolean;
481
+ * chronos.isValidDate(value: unknown): boolean;
482
+ * chronos.isDateString(value: unknown): boolean;
483
+ * chronos.isValidChronos(value: unknown): boolean;
484
+ * chronos.isReconstructable(value: unknown): value is ChronosProperties;
485
+ * chronos.reconstruct(value: ChronosProperties): Chronos;
486
+ * chronos.formatTimePart(time: string, format?: TimeParts): string;
487
+ * chronos.getDatesForDay(day: WeekDay, options?: WeekdayOptions): string[];
488
+ * chronos.use(plugin: ChronosPlugin): void;
489
+ * chronos.register(plugin: ChronosPlugin): void;
490
+ * ```
491
+ */
492
+ declare const chronos: ChronosStatics;
493
+ //#endregion
494
+ //#region src/index.d.ts
495
+ /**
496
+ * @class Creates a new immutable `Chronos` instance.
497
+ * - **Note**: *If a date is provided **without a time component**, the instance will default to `00:00:00.000` UTC
498
+ * and convert it to the **equivalent local time** using the current environment's UTC offset.*
499
+ *
500
+ * @param value - A date value (`number`, `string`, `Date`, or `Chronos` object).
501
+ *
502
+ * @remarks
503
+ * - If a string is provided, it should be in a format that can be parsed by the {@link Date} constructor.
504
+ * - If a number is provided, it should be a timestamp (milliseconds since the Unix epoch).
505
+ * - If a `Date` or `Chronos` object is provided, it will be handled internally to parse the date value.
506
+ *
507
+ * **It also accepts number values as following:**
508
+ * - **`year, month, date, hours, minutes, seconds, milliseconds`**: Individual components of a date-time to construct a `Chronos` instance.
509
+ * - **`year`**: A number representing the year. If the year is between 0 and 99, it will be assumed to be the year 1900 + the provided year.
510
+ * - **`month`**: A number between 1 and 12 representing the month (1 for January, 12 for December).
511
+ * - **`date`**: A number between 1 and 31 representing the day of the month.
512
+ * - **`hours`**: A number between 0 and 23 representing the hour of the day.
513
+ * - **`minutes`**: A number between 0 and 59 representing the minutes past the hour.
514
+ * - **`seconds`**: A number between 0 and 59 representing the seconds past the minute.
515
+ * - **`milliseconds`**: A number between 0 and 999 representing the milliseconds past the second.
516
+ *
517
+ * @returns Instance of `Chronos` with all methods and properties.
518
+ */
519
+ declare class Chronos {
520
+ #private;
521
+ /** Use `readonly and/or private` methods outside `Chronos`. Purpose: Plugin creation. */
522
+ protected static [INTERNALS]: ChronosInternals;
523
+ /** Origin of the `Chronos` instance (Method that created `new Chronos`), useful for tracking instance. */
524
+ origin: ChronosMethods | 'root';
525
+ /**
526
+ * * `Chronos` date/time as Native JS `Date` object.
527
+ *
528
+ * - Also accessible via {@link toDate} instance method.
529
+ */
530
+ native: Date;
531
+ /**
532
+ * * Current (time zone) UTC offset in `UTC±HH:mm` format.
533
+ *
534
+ * - Also accessible via {@link getTimeZoneOffset} instance method without `UTC` prefix (returns in `±HH:mm` format).
535
+ */
536
+ utcOffset: UTCOffset;
537
+ /**
538
+ * Represents the current timezone name (e.g., `"Bangladesh Standard Time"`), or falls back to the corresponding timezone identifier (e.g., `"Asia/Dhaka"`) if no name can be resolved.
539
+ *
540
+ * @remarks
541
+ * - Invoking the {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/conversion#timezone timeZone} method sets the timezone name that corresponds to the specified UTC offset, or the UTC offset itself if no name exists. For more details on this behavior, see {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/names#gettimezonename getTimeZoneName}.
542
+ * - To retrieve the local system's native timezone name (or its identifier if the name is unavailable), use the {@link $getNativeTimeZoneName} instance method.
543
+ */
544
+ timeZoneName: LooseLiteral<TimeZoneName>;
545
+ /**
546
+ * Represents the current timezone context, which can be a single identifier, an array of equivalent identifiers, or a UTC offset.
547
+ *
548
+ * - **{@link $TimeZoneIdentifier}** — e.g., `"Asia/Dhaka"`. Returned when the {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/conversion#timezone timeZone} method has not been invoked. It is default behavior.
549
+ * - **Array of {@link $TimeZoneIdentifier}** — e.g., `[ 'Asia/Calcutta', 'Asia/Colombo' ]`, used when multiple timezones share the same UTC offset such as `"UTC+05:30"`.
550
+ * - **{@link UTCOffset}** — e.g., `"UTC+06:45"` or `"UTC+02:15"`, returned when no named timezone corresponds to a given offset.
551
+ *
552
+ * @remarks
553
+ * - By default, when {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/conversion#timezone timeZone} is not applied, a single {@link $TimeZoneIdentifier} string is provided.
554
+ * - When applied, it may instead return a single identifier string, an array of equivalent identifiers or a UTC offset string.
555
+ * - To retrieve the local system's native timezone identifier, use the {@link $getNativeTimeZoneId} instance method.
556
+ */
557
+ timeZoneId: TimeZoneId;
558
+ /** Tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/conversion#timezone timeZone} method */
559
+ protected $tzTracker?: $TimeZoneIdentifier | TimeZone | UTCOffset;
560
+ /**
561
+ * * Creates a new immutable `Chronos` instance from current date & time (UTC).
562
+ *
563
+ * @returns Instance of `Chronos` with all methods and properties.
564
+ */
565
+ constructor();
566
+ /**
567
+ * * Creates a new immutable `Chronos` instance.
568
+ *
569
+ * @param value - A date value in `number`, it should be a timestamp (milliseconds since the Unix epoch).
570
+ *
571
+ * @returns Instance of `Chronos` with all methods and properties.
572
+ */
573
+ constructor(value: number);
574
+ /**
575
+ * * Creates a new immutable `Chronos` instance.
576
+ *
577
+ * **Note**: *If a date is provided **without a time component**, the instance will default to `00:00:00.000` UTC and convert it to the **equivalent local time** using the current environment's UTC offset.*
578
+ *
579
+ * @param value - A date value in `string`, it should be in a format that can be parsed by the {@link Date} constructor.
580
+ *
581
+ * @returns Instance of `Chronos` with all methods and properties.
582
+ */
583
+ constructor(value: string);
584
+ /**
585
+ * * Creates a new immutable `Chronos` instance.
586
+ *
587
+ * @param value - A date value as {@link Date} object.
588
+ *
589
+ * @returns Instance of `Chronos` with all methods and properties.
590
+ */
591
+ constructor(value: Date);
592
+ /**
593
+ * * Creates a new immutable `Chronos` instance.
594
+ *
595
+ * @param value - A date value as `Chronos` object.
596
+ *
597
+ * @returns Instance of `Chronos` with all methods and properties.
598
+ */
599
+ constructor(value: Chronos);
600
+ /**
601
+ * * Creates a new immutable `Chronos` instance.
602
+ *
603
+ * **Note**: *If a date is provided **without a time component**, the instance will default to `00:00:00.000` UTC and convert it to the **equivalent local time** using the current environment's UTC offset.*
604
+ *
605
+ * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99, year is assumed to be 1900 + year.
606
+ * @param month The month as a `number` between 1 and 12 (January to December).
607
+ * @param date The date as a `number` between 1 and 31.
608
+ * @param hours Must be supplied if minutes is supplied. A `number` from 0 to 23 (midnight to 11pm) that specifies the hour.
609
+ * @param minutes Must be supplied if seconds is supplied. A `number` from 0 to 59 that specifies the minutes.
610
+ * @param seconds Must be supplied if milliseconds is supplied. A `number` from 0 to 59 that specifies the seconds.
611
+ * @param ms A `number` from 0 to 999 that specifies the milliseconds.
612
+ *
613
+ * @returns Instance of `Chronos` with all methods and properties.
614
+ */
615
+ constructor(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number);
616
+ /**
617
+ * * Creates a new immutable `Chronos` instance.
618
+ *
619
+ * **Note**: *If a date is provided **without a time component**, the instance will default to `00:00:00.000` UTC and convert it to the **equivalent local time** using the current environment's UTC offset.*
620
+ *
621
+ * @param value - A date value (`number`, `string`, `Date`, or `Chronos` object).
622
+ * - If a `string` is provided, it should be in a format that can be parsed by the `Date` constructor.
623
+ * - If a `number` is provided, it should be a timestamp (milliseconds since the Unix epoch).
624
+ * - If a `Date` object is provided, it will be used as is.
625
+ * - If a `Chronos` object is provided, it will be used directly.
626
+ *
627
+ * @returns Instance of `Chronos` with all methods and properties.
628
+ */
629
+ constructor(value?: ChronosInput);
630
+ [Symbol.iterator](): IterableIterator<[string, number]>;
631
+ [Symbol.toPrimitive](hint: string): string | number;
632
+ [Symbol.replace](string: string, replacement: string): string;
633
+ [Symbol.search](string: string): number;
634
+ [Symbol.split](string: string): string[];
635
+ [Symbol.match](string: string): RegExpMatchArray | null;
636
+ get [Symbol.toStringTag](): string;
637
+ get [Symbol.isConcatSpreadable](): boolean;
638
+ /**
639
+ * @instance Retrieves the local system's current time zone name (e.g., `"Bangladesh Standard Time"`), or falls back to its corresponding IANA time zone identifier (e.g., `"Asia/Dhaka"`) if the name cannot be determined.
640
+ *
641
+ * @remarks
642
+ * - This method always reflects the local machine's time zone if `tzId` is parameter is omitted.
643
+ * - {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/conversion#timezone timeZone}, {@link utc}, or {@link toUTC} methods have no effects on this method.
644
+ * - To access the time zone name of a modified or converted instance, use the {@link timeZoneName} public property instead.
645
+ *
646
+ * @param tzId Optional time zone identifier to get time zone name for that specific identifier if available.
647
+ *
648
+ * @returns The resolved time zone name or its IANA identifier as a fallback.
649
+ */
650
+ $getNativeTimeZoneName(tzId?: $TimeZoneIdentifier): $NativeTzNameOrId;
651
+ /**
652
+ * @instance Retrieves the IANA time zone identifier (e.g., `"Asia/Dhaka"`, `"Africa/Harare"`) for the local system's current time zone.
653
+ *
654
+ * @remarks
655
+ * - This method always returns the identifier of the local machine's time zone.
656
+ * - {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/conversion#timezone timeZone}, {@link utc}, or {@link toUTC} methods have no effects on this method.
657
+ * - To obtain the identifier(s) of a modified or converted instance, use the {@link timeZoneId} public property instead.
658
+ *
659
+ * @returns The local system's IANA time zone identifier.
660
+ */
661
+ $getNativeTimeZoneId(): TimeZoneIdNative;
662
+ /** Gets the full year of the date. */
663
+ get year(): number;
664
+ /** Gets the month (0-11) of the date. */
665
+ get month(): Enumerate<12>;
666
+ /** Gets the day of the month (1-31). */
667
+ get date(): NumberRange<1, 31>;
668
+ /** Gets the day of the week (0-6, where 0 is Sunday). */
669
+ get weekDay(): Enumerate<7>;
670
+ /** Gets the hour (0-23) of the date. */
671
+ get hour(): Enumerate<24>;
672
+ /** Gets the minute (0-59) of the date. */
673
+ get minute(): Enumerate<60>;
674
+ /** Gets the second (0-59) of the date. */
675
+ get second(): Enumerate<60>;
676
+ /** Gets the millisecond (0-999) of the date. */
677
+ get millisecond(): Milliseconds;
678
+ /** Gets ISO weekday: 1 = Monday, 7 = Sunday */
679
+ get isoWeekDay(): NumberRange<1, 7>;
680
+ /** Gets ISO month (1–12 instead of 0–11) */
681
+ get isoMonth(): NumberRange<1, 12>;
682
+ /** Returns the Unix timestamp (seconds since the Unix epoch: January 1, 1970, UTC). */
683
+ get unix(): number;
684
+ /** Gets the time value in milliseconds since midnight, January 1, 1970 UTC. */
685
+ get timestamp(): number;
686
+ /** * Gets the last date (number) of the current month `(28, 29, 30 or 31)`. */
687
+ get lastDateOfMonth(): NumberRange<28, 31>;
688
+ /** @instance Returns a debug-friendly string for `console.log` or `util.inspect`. */
689
+ inspect(): string;
690
+ /** @instance Enables `JSON.stringify` to show readable output. Calls {@link toLocalISOString} method. */
691
+ toJSON(): string;
692
+ /** @instance Enables arithmetic and comparison operations (e.g., `+new Chronos()`). Calls {@link getTimeStamp} method. */
693
+ valueOf(): number;
694
+ /** @instance Clones and returns exactly same `Chronos` instance. */
695
+ clone(): Chronos;
696
+ /** @instance Gets the native `Date` instance of the current `Chronos`. */
697
+ toDate(): Date;
698
+ /** @instance Returns a string representation of a date. */
699
+ toString(): string;
700
+ /** @instance Returns ISO time string in appropriate time zone with offset. */
701
+ toLocalISOString(): ISOTimeString;
702
+ /** @instance Returns a date as a string value in ISO format (UTC). */
703
+ toISOString(): ISODateTimeString;
704
+ /**
705
+ * @instance Wrapper over native {@link Date.toLocaleString} with improved type system.
706
+ * @description Converts a date and time to a string by using the current or specified locale.
707
+ *
708
+ * @param locales A locale string, array of locale strings, {@link Intl.Locale} object, or array of {@link Intl.Locale} objects that contain one or more language or locale tags (see: {@link LocalesArguments}). If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
709
+ * @param options An object that contains one or more properties that specify comparison options (see: {@link DateTimeFormatOptions}).
710
+ */
711
+ toLocaleString(locales?: LocalesArguments, options?: DateTimeFormatOptions): string;
712
+ /** @instance Returns the time value in milliseconds since midnight, January 1, 1970 UTC. */
713
+ getTimeStamp(): number;
714
+ /**
715
+ * @instance Formats the current date into a custom string format (local time by default).
716
+ *
717
+ * @param format - The desired format string (Default: `dd, mmm DD, YYYY HH:mm:ss` → e.g., `Sun, Apr 06, 2025 16:11:55`).
718
+ *
719
+ * - To output raw text (i.e., not interpreted as a date token), wrap it in square brackets.
720
+ * - For example, `[Today is] ddd` results in `Today is Sunday`, and `YYYY[ year]` results in `2025 year`.
721
+ *
722
+ * - Supported format tokens include: `YYYY`, `YY`, `mmmm`, `mmm`, `MM`, `M`, `DD`, `D`, `dd`, `ddd`, `Do`, `HH`, `H`, `hh`, `h`, `mm`, `m`, `ss`, `s`, `ms`, `mss`, `a`, `A`, `ZZ` and `Z`.
723
+ * - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
724
+ * - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/format#format-tokens format tokens} for details.
725
+ *
726
+ * @param useUTC - Optional boolean to format the date using UTC time.
727
+ * When `true`, it behaves like `formatUTC()` and outputs time based on UTC offset. Defaults to `false`.
728
+ *
729
+ * @returns Formatted date string using the specified format.
730
+ * Uses local time by default unless `useUTC` is set to `true`.
731
+ */
732
+ format(format?: string, useUTC?: boolean): string;
733
+ /**
734
+ * @instance Formats the date into a predefined strict string format using local time or UTC.
735
+ *
736
+ * @remarks Offers `over 21,300` predefined formats with full IntelliSense support.
737
+ *
738
+ * @param format - The desired format string. Defaults to `'dd, mmm DD, YYYY HH:mm:ss'`
739
+ * (e.g., `'Sun, Apr 06, 2025 16:11:55'`).
740
+ * - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/format#format-tokens format tokens} for details.
741
+ *
742
+ * @param useUTC - If `true`, formats the date in UTC (equivalent to `formatUTC()`).
743
+ * Defaults to `false` (local time).
744
+ * @returns A formatted date string in the specified format.
745
+ */
746
+ formatStrict(format?: StrictFormat, useUTC?: boolean): string;
747
+ /**
748
+ * @instance Formats the date into a custom string format (UTC time).
749
+ *
750
+ * @param format - The desired format (Default format is `dd, mmm DD, YYYY HH:mm:ss:mss` = `Sun, Apr 06, 2025 16:11:55:379`).
751
+ *
752
+ * - To output raw text (i.e., not interpreted as a date token), wrap it in square brackets.
753
+ * - For example, `[Today is] ddd` results in `Today is Sunday`, and `YYYY[ year]` results in `2025 year`.
754
+ *
755
+ * - Supported format tokens include: `YYYY`, `YY`, `mmmm`, `mmm`, `MM`, `M`, `DD`, `D`, `dd`, `ddd`, `Do`, `HH`, `H`, `hh`, `h`, `mm`, `m`, `ss`, `s`, `ms`, `mss`, `a`, `A`, `ZZ` and `Z`.
756
+ * - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
757
+ * - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/format#format-tokens format tokens} for details.
758
+ *
759
+ * @returns Formatted date string in desired format (UTC time).
760
+ */
761
+ formatUTC(format?: string): string;
762
+ /**
763
+ * @instance Adds seconds and returns a new immutable instance.
764
+ * @param seconds - Number of seconds to add.
765
+ * @returns A new `Chronos` instance with the updated date.
766
+ */
767
+ addSeconds(seconds: number): Chronos;
768
+ /**
769
+ * @instance Adds minutes and returns a new immutable instance.
770
+ * @param minutes - Number of minutes to add.
771
+ * @returns A new `Chronos` instance with the updated date.
772
+ */
773
+ addMinutes(minutes: number): Chronos;
774
+ /**
775
+ * @instance Adds hours and returns a new immutable instance.
776
+ * @param hours - Number of hours to add.
777
+ * @returns A new `Chronos` instance with the updated date.
778
+ */
779
+ addHours(hours: number): Chronos;
780
+ /**
781
+ * @instance Adds days and returns a new immutable instance.
782
+ * @param days - Number of days to add.
783
+ * @returns A new `Chronos` instance with the updated date.
784
+ */
785
+ addDays(days: number): Chronos;
786
+ /**
787
+ * @instance Adds weeks and returns a new immutable instance.
788
+ * @param weeks - Number of weeks to add.
789
+ * @returns A new `Chronos` instance with the updated date.
790
+ */
791
+ addWeeks(weeks: number): Chronos;
792
+ /**
793
+ * @instance Adds months and returns a new immutable instance.
794
+ * @param months - Number of months to add.
795
+ * @returns A new `Chronos` instance with the updated date.
796
+ */
797
+ addMonths(months: number): Chronos;
798
+ /**
799
+ * @instance Adds years and returns a new immutable instance.
800
+ * @param years - Number of years to add.
801
+ * @returns A new `Chronos` instance with the updated date.
802
+ */
803
+ addYears(years: number): Chronos;
804
+ /**
805
+ * @instance Checks if the current year is a leap year.
806
+ * - A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400.
807
+ * - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not.
808
+ * @param year - Optional year to check. Default is the year from current `Chronos` instance.
809
+ * @returns `true` if the year is a leap year, `false` otherwise.
810
+ */
811
+ isLeapYear(year?: number): boolean;
812
+ /** @instance Checks if another date is exactly equal to this one. */
813
+ isEqual(other: ChronosInput): boolean;
814
+ /** @instance Checks if another date is exactly equal to or before this one. */
815
+ isEqualOrBefore(other: ChronosInput): boolean;
816
+ /** @instance Checks if another date is exactly equal to or after this one. */
817
+ isEqualOrAfter(other: ChronosInput): boolean;
818
+ /**
819
+ * @instance Checks if another date is the same as this one in a specific unit.
820
+ * @param other The other date to compare.
821
+ * @param unit The unit to compare.
822
+ * @param weekStartsOn Optional: Day the week starts on (0 = Sunday, 1 = Monday). Applicable if week day is required. Default is `0`.
823
+ */
824
+ isSame(other: ChronosInput, unit: TimeUnit, weekStartsOn?: Enumerate<7>): boolean;
825
+ /**
826
+ * @instance Checks if this date is before another date in a specific unit.
827
+ * @param other The other date to compare.
828
+ * @param unit The unit to compare.
829
+ * @param weekStartsOn Optional: Day the week starts on (0 = Sunday, 1 = Monday). Applicable if week day is required. Default is `0`.
830
+ */
831
+ isBefore(other: ChronosInput, unit: TimeUnit, weekStartsOn?: Enumerate<7>): boolean;
832
+ /**
833
+ * @instance Checks if this date is after another date in a specific unit.
834
+ * @param other The other date to compare.
835
+ * @param unit The unit to compare.
836
+ * @param weekStartsOn Optional: Day the week starts on (0 = Sunday, 1 = Monday). Applicable if week day is required. Default is `0`.
837
+ */
838
+ isAfter(other: ChronosInput, unit: TimeUnit, weekStartsOn?: Enumerate<7>): boolean;
839
+ /**
840
+ * @instance Checks if this date is the same or before another date in a specific unit.
841
+ * @param other The other date to compare.
842
+ * @param unit The unit to compare.
843
+ * @param weekStartsOn Optional: Day the week starts on (0 = Sunday, 1 = Monday). Applicable if week day is required. Default is `0`.
844
+ */
845
+ isSameOrBefore(other: ChronosInput, unit: TimeUnit, weekStartsOn?: Enumerate<7>): boolean;
846
+ /**
847
+ * @instance Checks if this date is the same or after another date in a specific unit.
848
+ * @param other The other date to compare.
849
+ * @param unit The unit to compare.
850
+ * @param weekStartsOn Optional: Day the week starts on (0 = Sunday, 1 = Monday). Applicable if week day is required. Default is `0`.
851
+ */
852
+ isSameOrAfter(other: ChronosInput, unit: TimeUnit, weekStartsOn?: Enumerate<7>): boolean;
853
+ /**
854
+ * @instance Checks if the current date is between the given start and end dates.
855
+ *
856
+ * @param start - The start of the range.
857
+ * @param end - The end of the range.
858
+ * @param inclusive - Specifies whether the comparison is inclusive or exclusive:
859
+ * - `'[]'`: inclusive of both start and end (≥ start and ≤ end)
860
+ * - `'[)'`: inclusive of start, exclusive of end (≥ start and < end)
861
+ * - `'(]'`: exclusive of start, inclusive of end (> start and ≤ end)
862
+ * - `'()'`: exclusive of both start and end (> start and < end)
863
+ *
864
+ * @returns `true` if the current date is within the specified range based on the `inclusive` mode.
865
+ */
866
+ isBetween(start: ChronosInput, end: ChronosInput, inclusive?: '[]' | '[)' | '(]' | '()'): boolean;
867
+ /**
868
+ * @instance Checks if the date is within daylight saving time (DST).
869
+ * @returns Whether the date is in DST (`true` or `false`).
870
+ */
871
+ isDST(): boolean;
872
+ /** @instance Checks if current day is the first day of the current month. */
873
+ isFirstDayOfMonth(): boolean;
874
+ /** @instance Checks if current day is the last day of the current month. */
875
+ isLastDayOfMonth(): boolean;
876
+ /** @instance Returns a new `Chronos` instance set to the first day of the current month. */
877
+ firstDayOfMonth(): Chronos;
878
+ /** @instance Returns a new `Chronos` instance set to the last day of the current month. */
879
+ lastDayOfMonth(): Chronos;
880
+ /**
881
+ * @instance Returns a new `Chronos` instance at the start of a given unit.
882
+ * @param unit The unit to reset (e.g., year, month, day).
883
+ * @param weekStartsOn Optional: Day the week starts on (0 = Sunday, 1 = Monday). Applicable if week day is required. Default is `0`.
884
+ */
885
+ startOf(unit: TimeUnit, weekStartsOn?: Enumerate<7>): Chronos;
886
+ /**
887
+ * @instance Returns a new `Chronos` instance at the end of a given unit.
888
+ * @param unit The unit to adjust (e.g., year, month, day).
889
+ * @param weekStartsOn Optional: Day the week starts on (0 = Sunday, 1 = Monday). Applicable if week day is required. Default is `0`.
890
+ */
891
+ endOf(unit: TimeUnit, weekStartsOn?: Enumerate<7>): Chronos;
892
+ /**
893
+ * @instance Returns a new `Chronos` instance with the specified unit added.
894
+ * @param number The number of time unit to add (can be negative).
895
+ * @param unit The time unit to add.
896
+ */
897
+ add(number: number, unit: TimeUnit): Chronos;
898
+ /**
899
+ * @instance Returns a new `Chronos` instance with the specified unit subtracted.
900
+ * @param number The number of time unit to subtract (can be negative).
901
+ * @param unit The time unit to add.
902
+ */
903
+ subtract(number: number, unit: TimeUnit): Chronos;
904
+ /**
905
+ * @instance Gets the value of a specific time unit from the date.
906
+ * @param unit The unit to retrieve. Type of return value is determined by `unit`.
907
+ */
908
+ get<Unit extends TimeUnit>(unit: Unit): TimeUnitValue<Unit>;
909
+ /**
910
+ * @instance Returns a new `Chronos` instance with the specified unit set to the given value.
911
+ * @param unit The unit to modify. Type of `value` is determined by `unit`.
912
+ * @param value The value to set for the unit. Type of `value` is determined by `unit`.
913
+ */
914
+ set<Unit extends TimeUnit>(unit: Unit, value: TimeUnitValue<Unit>): Chronos;
915
+ /**
916
+ * @instance Returns the difference between current and another date in the given unit.
917
+ * @param other The other date to compare.
918
+ * @param unit The unit in which to return the difference.
919
+ * @returns Difference in number (either `integer` or `float`).
920
+ */
921
+ diff(other: ChronosInput, unit: TimeUnit): number;
922
+ /**
923
+ * @instance Returns a human-readable relative calendar time like "Today at 3:00 PM"
924
+ * @param baseDate Optional base date to compare with.
925
+ */
926
+ calendar(baseDate?: ChronosInput): string;
927
+ /** @instance Returns a short human-readable string like "2h ago", "in 5m". From `year` to `second`. */
928
+ fromNowShort(): string;
929
+ /**
930
+ * @instance Sets the date to the Monday of the specified ISO week number within the current year.
931
+ * This method assumes ISO week logic, where week 1 is the week containing January 4th.
932
+ *
933
+ * @param week The ISO week number (1–53) to set the date to.
934
+ * @returns A new `Chronos` instance set to the start (Monday) of the specified week.
935
+ */
936
+ setWeek(week: NumberRange<1, 53>): Chronos;
937
+ /**
938
+ * @instance Calculates the ISO 8601 week number of the year.
939
+ *
940
+ * @Remarks ISO weeks start on Monday, and the first week of the year is the one containing January 4th.
941
+ *
942
+ * @returns Week number (1–53).
943
+ */
944
+ getWeek(): NumberRange<1, 53>;
945
+ /**
946
+ * @instance Calculates the week number of the year based on custom week start.
947
+ * @param weekStartsOn Optional: Day the week starts on (0 = Sunday, 1 = Monday). Applicable if week day is required. Default is `0`.
948
+ * @returns Week number (1-53).
949
+ */
950
+ getWeekOfYear(weekStartsOn?: Enumerate<7>): NumberRange<1, 53>;
951
+ /**
952
+ * @instance Returns the ISO week-numbering year for the current date.
953
+ *
954
+ * The ISO week-numbering year may differ from the calendar year.
955
+ * For example, January 1st may fall in the last ISO week of the previous year.
956
+ *
957
+ * @param weekStartsOn Optional: Defines the start day of the week (0 = Sunday, 1 = Monday).
958
+ * Defaults to `0` (Sunday). Use 1 for strict ISO 8601.
959
+ * @returns The ISO week-numbering year.
960
+ */
961
+ getWeekYear(weekStartsOn?: Enumerate<7>): number;
962
+ /** @instance Returns day of year (1 - 366) */
963
+ getDayOfYear(): NumberRange<1, 366>;
964
+ /** @instance Returns number of days in current month */
965
+ daysInMonth(): NumberRange<28, 31>;
966
+ /** @instance Converts to object with all date unit parts */
967
+ toObject(): ChronosObject;
968
+ /** @instance Converts to array with all date unit parts */
969
+ toArray(): TupleOf<number, 12>;
970
+ /**
971
+ * @instance Returns the **calendar quarter** (1 to 4) of the current date.
972
+ *
973
+ * @remarks
974
+ * A calendar year is divided into four quarters:
975
+ *
976
+ * - `Q1`: January to March
977
+ * - `Q2`: April to June
978
+ * - `Q3`: July to September
979
+ * - `Q4`: October to December
980
+ *
981
+ * This method strictly uses the **calendar year**. For fiscal quarters, use {@link toFiscalQuarter} instead.
982
+ *
983
+ * @example
984
+ * new Chronos('2025-02-14').toQuarter(); // 1
985
+ * new Chronos('2025-08-09').toQuarter(); // 3
986
+ *
987
+ * @returns The calendar quarter number (1–4).
988
+ */
989
+ toQuarter(): Quarter;
990
+ /**
991
+ * @instance Returns the system's current UTC offset formatted as `±HH:mm` (`+06:00` or `-07:00`).
992
+ *
993
+ * - *Unlike JavaScript's {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset `Date.prototype.getTimezoneOffset()`}, which returns the offset in minutes **behind** UTC (positive for locations west of UTC and negative for east), this method returns the more intuitive sign format used in timezone representations (e.g., `+06:00` means 6 hours **ahead** of UTC).*
994
+ *
995
+ * @returns The (local) system's UTC offset in `±HH:mm` format.
996
+ */
997
+ getUTCOffset(): $UTCOffset;
998
+ /**
999
+ * @instance Returns the timezone offset of this `Chronos` instance in `±HH:mm` format maintaining current timezone.
1000
+ *
1001
+ * - *Unlike JavaScript's {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset `Date.prototype.getTimezoneOffset()`}, which returns the offset in minutes **behind** UTC (positive for locations west of UTC and negative for east), this method returns the more intuitive sign format used in timezone representations (e.g., `+06:00` means 6 hours **ahead** of UTC).*
1002
+ *
1003
+ * @returns The timezone offset string in `±HH:mm` format maintaining the current timezone regardless of system having different one.
1004
+ */
1005
+ getTimeZoneOffset(): $UTCOffset;
1006
+ /**
1007
+ * @instance Gets the difference in minutes between Universal Coordinated Time (UTC) and the time on the local computer.
1008
+ *
1009
+ * - *Unlike JavaScript's {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset `Date.prototype.getTimezoneOffset()`}, this method returns a positive value if the local time is ahead of UTC, and negative if behind UTC.*
1010
+ *
1011
+ * For example, for `UTC+06:00`, this returns `360`; for `UTC-05:30`, this returns `-330`.
1012
+ *
1013
+ * @returns The system's UTC offset in minutes, matching the sign convention used in `±HH:mm`.
1014
+ */
1015
+ getUTCOffsetMinutes(): number;
1016
+ /**
1017
+ * @instance Returns the current `Chronos` instance's UTC offset in minutes.
1018
+ *
1019
+ * This reflects the parsed or stored offset used internally by `Chronos` and follows the same
1020
+ * sign convention: positive for timezones ahead of UTC, negative for behind.
1021
+ *
1022
+ * @returns The UTC offset in minutes maintaining the current timezone regardless of system having different one.
1023
+ */
1024
+ getTimeZoneOffsetMinutes(): number;
1025
+ /** @instance Returns new `Chronos` instance in UTC time */
1026
+ toUTC(): Chronos;
1027
+ /** @instance Returns new `Chronos` instance in local time */
1028
+ toLocal(): Chronos;
1029
+ /**
1030
+ * @instance Returns the name of the current day or optional day index.
1031
+ * @param index Optional day index (`0–6`, where `0` is `Sunday`) to override current day.
1032
+ * @returns Name of the weekday, e.g., `'Monday'`, `'Tuesday'` etc.
1033
+ */
1034
+ day(index?: Enumerate<7>): WeekDay;
1035
+ /**
1036
+ * @instance Returns the name of the current month or optional month index.
1037
+ * @param index Optional month index (`0–11`, where `0` is `January`) to override current month.
1038
+ * @returns Name of the month, e.g., `'January'`, `'February'` etc.
1039
+ */
1040
+ monthName(index?: Enumerate<12>): MonthName;
1041
+ /**
1042
+ * @static Parses a date string with a given format (limited support only).
1043
+ *
1044
+ * **Supported format tokens**:
1045
+ * - `YYYY`: Full year (e.g., 2023)
1046
+ * - `YY`: Two-digit year (e.g., 23 for 2023, 99 for 1999)
1047
+ * - `MM`: Month (01-12)
1048
+ * - `M`: Month (1-12)
1049
+ * - `DD`: Day of the month (01-31)
1050
+ * - `D`: Day of the month (1-31)
1051
+ * - `HH`: Hour (00-23)
1052
+ * - `H`: Hour (0-23)
1053
+ * - `mm`: Minute (00-59)
1054
+ * - `m`: Minute (0-59)
1055
+ * - `ss`: Second (00-59)
1056
+ * - `s`: Second (0-59)
1057
+ * - `mss`: Millisecond (000-999)
1058
+ * - `ms`: Millisecond (0-999)
1059
+ *
1060
+ * @example
1061
+ * Chronos.parse('23-12-31 15:30:45', 'YY-MM-DD HH:mm:ss');
1062
+ * // returns `Chronos` instance with the parsed date 2023-12-31T15:30:45
1063
+ *
1064
+ * @param dateStr - The date string to be parsed
1065
+ * @param format - The format of the date string. Supported tokens `YYYY`, `YY` `MM`, `M`, `DD`, `D`, `HH`, `H`, `mm`, `m`, `ss`, `s`, `mss`, `ms` are used to specify the structure.
1066
+ * @returns A new `Chronos` instance representing the parsed date.
1067
+ * @throws `Error` If the date string does not match the format.
1068
+ */
1069
+ static parse(dateStr: string, format: string): Chronos;
1070
+ /**
1071
+ * @static Creates a new `Chronos` instance with the provided time component(s).
1072
+ *
1073
+ * @param options - One or more time components to override.
1074
+ * @returns A new `Chronos` instance with the provided time components applied.
1075
+ *
1076
+ * @remarks
1077
+ * - Unspecified components are filled with the current time's (`Chronos`) respective values.
1078
+ * - For option `month`, value should be number from `1` (January) to `12` (December).
1079
+ * - If the `date` component is omitted and the current day is the last day of its month,
1080
+ * the resulting instance will also use the last day of the target month.
1081
+ * - _This rule does **not** apply if the `date` component is explicitly provided,
1082
+ * even if that value exceeds the last day of the target month._
1083
+ *
1084
+ * @example
1085
+ * // Override only the year and month
1086
+ * const c = Chronos.with({ year: 2025, month: 12 });
1087
+ */
1088
+ static with(options: ChronosWithOptions): Chronos;
1089
+ /**
1090
+ * @static Returns the current date and time in a specified format in local time.
1091
+ * * Default format is dd, `mmm DD, YYYY HH:mm:ss` = `Sun, Apr 06, 2025 16:11:55`
1092
+ * @param options - Configure format string and whether to format using utc offset.
1093
+ * @returns Formatted date string in desired format.
1094
+ */
1095
+ static today(options?: FormatOptions): string;
1096
+ /**
1097
+ * @static Returns a new `Chronos` instance representing yesterday's date.
1098
+ *
1099
+ * @returns A `Chronos` instance for the previous calendar day.
1100
+ */
1101
+ static yesterday(): Chronos;
1102
+ /**
1103
+ * @static Returns a new `Chronos` instance representing tomorrow's date.
1104
+ *
1105
+ * @returns A `Chronos` instance for the next calendar day.
1106
+ */
1107
+ static tomorrow(): Chronos;
1108
+ /**
1109
+ * @static Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
1110
+ * * It basically calls {@link Date.now()}.
1111
+ * @returns The number of milliseconds elapsed since the Unix epoch.
1112
+ */
1113
+ static now(): number;
1114
+ /**
1115
+ * @static Creates a UTC-based `Chronos` instance.
1116
+ * If no date is provided, it uses the current date and time.
1117
+ *
1118
+ * **This is the base time, meaning conversion in other timezone will consider UTC time as the base time.**
1119
+ *
1120
+ * @param dateLike Optional input date to base the UTC time on.
1121
+ * If omitted, the current system date/time is used.
1122
+ * @returns A new `Chronos` instance representing the UTC equivalent of the input.
1123
+ */
1124
+ static utc(dateLike?: ChronosInput): Chronos;
1125
+ /**
1126
+ * @static Formats a time-only string into a formatted time string.
1127
+ *
1128
+ * @param time - Time string to be formatted. Supported formats include:
1129
+ * - `HH:mm` → e.g., `'14:50'`
1130
+ * - `HH:mm:ss` → e.g., `'14:50:00'`
1131
+ * - `HH:mm:ss.mss` → e.g., `'14:50:00.800'`
1132
+ * - `HH:mm+TimeZoneOffset(HH)` → e.g., `'14:50+06'`
1133
+ * - `HH:mm+TimeZoneOffset(HH:mm)` → e.g., `'14:50+06:00'`
1134
+ * - `HH:mm:ss+TimeZoneOffset(HH)` → e.g., `'14:50:00+06'`
1135
+ * - `HH:mm:ss+TimeZoneOffset(HH:mm)` → e.g., `'14:50:00+05:30'`
1136
+ * - `HH:mm:ss.mss+TimeZoneOffset(HH)` → e.g., `'14:50:00.800+06'`
1137
+ * - `HH:mm:ss.mss+TimeZoneOffset(HH:mm)` → e.g., `'14:50:00.800+06:30'`
1138
+ *
1139
+ * - *Input will default to today's date and assume local timezone if no offset is provided.*
1140
+ *
1141
+ * @param format - Format tokens accepted by {@link formatStrict()} method ({@link TimeOnlyFormat}) for time part only.
1142
+ * Default: `hh:mm:ss a` → 02:33:36 pm.
1143
+ * @returns Formatted time string in local (System) time.
1144
+ */
1145
+ static formatTimePart(time: string, format?: TimeOnlyFormat): string;
1146
+ /**
1147
+ * @static Returns ISO date strings for each occurrence of a weekday from today, spanning a relative time range.
1148
+ *
1149
+ * @param day - The weekday to match (e.g., `'Wednesday'`, `'Sunday'`).
1150
+ * @param options - Relative range (e.g., 7 days, 4 weeks) and output format (local with timezone or utc).
1151
+ * @returns Array of ISO date strings in the specified format. Returns empty array if no matches in the time span.
1152
+ *
1153
+ * - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/statics#getdatesforday docs} for details.
1154
+ *
1155
+ * @example
1156
+ * Chronos.getDatesForDay('Wednesday', { span: 7, unit: 'day' });
1157
+ * //=> [ '2025-05-28T21:16:06.198+06:00', '2025-06-04T21:16:06.198+06:00' ]
1158
+ *
1159
+ * @example
1160
+ * Chronos.getDatesForDay('Wednesday', {
1161
+ * span: 7,
1162
+ * unit: 'day',
1163
+ * format: 'utc'
1164
+ * });
1165
+ * //=> [ '2025-05-28T15:17:10.812Z', '2025-06-04T15:17:10.812Z' ]
1166
+ */
1167
+ static getDatesForDay(day: WeekDay, options?: RelativeRangeOptions): string[];
1168
+ /**
1169
+ * @static Returns ISO date strings for each occurrence of a weekday between two fixed dates.
1170
+ *
1171
+ * @param day - The weekday to match (e.g., `'Monday'`, `'Friday'`).
1172
+ * @param options - Date range (from/to, e.g. `'2025-06-30'`, ` new Date()`, `new Chronos()` etc.) and output format (local with timezone or utc).
1173
+ * @returns Array of ISO date strings in the specified format. Returns empty array if no matches in the range.
1174
+ *
1175
+ * - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/statics#getdatesforday docs} for details.
1176
+ *
1177
+ * @remarks
1178
+ * - When using `Chronos` instances for `from` and/or `to`, ensure both are created in the **same time zone** to avoid mismatched boundaries.
1179
+ * - Mixing zones may shift the interpreted start or end by several hours, which can cause the range to include or exclude incorrect weekdays.
1180
+ *
1181
+ * @example
1182
+ * Chronos.getDatesForDay('Monday', {
1183
+ * from: '2025-05-28',
1184
+ * to: '2025-06-30',
1185
+ * format: 'local'
1186
+ * });
1187
+ * //=> [ '2025-01-06T...', '2025-01-13T...', ... ]
1188
+ */
1189
+ static getDatesForDay(day: WeekDay, options?: DateRangeOptions): string[];
1190
+ /**
1191
+ * @static Returns the earliest `Chronos` instance based on the underlying universal {@link timestamp}.
1192
+ *
1193
+ * @remarks
1194
+ * - All inputs are normalized to `Chronos` instances before comparison.
1195
+ * - Comparison is always performed using each instance's **UTC timestamp**, ensuring a consistent and timezone-agnostic result.
1196
+ * - When exactly two values are provided, the first value becomes the initial candidate; if the second value represents an earlier moment in time, it replaces the candidate.
1197
+ * - The returned value is **not** one of the input objects. A new immutable `Chronos` instance is always created. Its internal timezone, offset, name, and tracking information are cloned from the winning input instance.
1198
+ *
1199
+ * @param dates A list of Chronos-compatible inputs (`string`, `number`, `Date` or `Chronos`).
1200
+ * @returns A new `Chronos` instance representing the earliest moment.
1201
+ */
1202
+ static min(...dates: ChronosInput[]): Chronos;
1203
+ /**
1204
+ * @static Returns the latest `Chronos` instance based on the underlying universal {@link timestamp}.
1205
+ *
1206
+ * @remarks
1207
+ * - All inputs are normalized to `Chronos` instances before comparison.
1208
+ * - Comparison is always performed using each instance's **UTC timestamp**, ensuring a consistent and timezone-agnostic result.
1209
+ * - When exactly two values are provided, the first value becomes the initial candidate; if the second value represents a later moment in time, it replaces the candidate.
1210
+ * - The returned value is **not** one of the input objects. A new immutable `Chronos` instance is always created. Its internal timezone, offset, name, and tracking information are cloned from the winning input instance.
1211
+ *
1212
+ * @param dates A list of Chronos-compatible inputs (`string`, `number`, `Date` or `Chronos`).
1213
+ * @returns A new `Chronos` instance representing the latest moment.
1214
+ */
1215
+ static max(...dates: ChronosInput[]): Chronos;
1216
+ /**
1217
+ * @static Checks if the year in the date string or year (from 0 - 9999) is a leap year.
1218
+ * - A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400.
1219
+ * - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not.
1220
+ *
1221
+ * @description
1222
+ * This method accepts different types of date inputs and extracts the year to check if it's a leap year.
1223
+ * If the provided date is a `number`, it will be treated as a year (must be a valid year from 0 to 9999).
1224
+ * If the year is out of this range (negative or larger than 9999), it will be treated as a Unix timestamp.
1225
+ * If the provided date is a string or a `Date` object, it will be parsed and the year will be extracted.
1226
+ * If a `Chronos` instance is passed, the year will be directly accessed from the instance.
1227
+ *
1228
+ * @param date - A `number` (year or Unix timestamp), `string`, `Date`, or `Chronos` instance representing a date.
1229
+ * @returns `true` if the year is a leap year, `false` otherwise.
1230
+ */
1231
+ static isLeapYear(date: ChronosInput): boolean;
1232
+ /**
1233
+ * @static Checks if the given value is a valid `Date` object.
1234
+ * - A value is considered valid if it is an instance of the built-in `Date` class.
1235
+ * - This does not check whether the date itself is valid (e.g., `new Date('invalid')`).
1236
+ * @param value - The value to test.
1237
+ * @returns `true` if the value is a valid `Date` object, otherwise `false`.
1238
+ */
1239
+ static isValidDate(value: unknown): value is Date;
1240
+ /**
1241
+ * @static Checks if the given value is a valid date string.
1242
+ * - A value is considered a valid date string if it is a string and can be parsed by `Date.parse()`.
1243
+ * - This uses the native JavaScript date parser internally.
1244
+ * @param value - The value to test.
1245
+ * @returns `true` if the value is a valid date string, otherwise `false`.
1246
+ */
1247
+ static isDateString(value: unknown): value is string;
1248
+ /**
1249
+ * @static Checks if the given value is an instance of `Chronos`.
1250
+ * - Useful for verifying `Chronos` objects in type guards or validations.
1251
+ * @param value - The value to test.
1252
+ * @returns `true` if the value is an instance of `Chronos`, otherwise `false`.
1253
+ */
1254
+ static isValidChronos(value: unknown): value is Chronos;
1255
+ /**
1256
+ * @static Checks if the given value has the necessary properties to be reconstructed into a `Chronos` instance.
1257
+ * - Can be used for validating objects that may represent serialized `Chronos` data.
1258
+ * @param value - The value to check.
1259
+ * @returns `true` if the value has the required properties for reconstruction, otherwise `false`.
1260
+ */
1261
+ static isReconstructable(value: unknown): value is ChronosProperties;
1262
+ /**
1263
+ * @static Reconstructs a `Chronos` instance from an object containing the necessary properties.
1264
+ * - The input object must have the properties defined in {@link ChronosProperties} interface.
1265
+ * - If the input is not reconstructable, an error is thrown.
1266
+ *
1267
+ * @param value - An object containing the properties required to reconstruct a `Chronos` instance.
1268
+ * @returns A new `Chronos` instance created from the provided properties.
1269
+ * @throws `TypeError` if the input value does not have the necessary properties for reconstruction.
1270
+ */
1271
+ static reconstruct(value: ChronosProperties): Chronos;
1272
+ /**
1273
+ * @static Injects a plugin into the `Chronos` system.
1274
+ * @param plugin The plugin to inject.
1275
+ *
1276
+ * @remarks
1277
+ * - Using this (`use`) method in `React` projects may trigger *linter error* like `"React Hooks must be called in a React function component or a custom React Hook function."`
1278
+ * - To prevent this incorrect *linter error* in `React` projects, prefer using {@link register} method (alias `use` method).
1279
+ *
1280
+ * - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
1281
+ * - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/plugins#-official-plugins full list of plugins and the methods they register}.
1282
+ */
1283
+ static use(plugin: ChronosPlugin): void;
1284
+ /**
1285
+ * @static Registers a plugin into the `Chronos` system.
1286
+ * @param plugin The plugin to register.
1287
+ *
1288
+ * @remarks
1289
+ * - This is just an alias for {@link use} method.
1290
+ * - Using {@link use} method in `React` projects may trigger *linter error* like `"React Hooks must be called in a React function component or a custom React Hook function."`
1291
+ * - To prevent this incorrect *linter error* in `React` projects, prefer using this (`register`) method over {@link use} method.
1292
+ *
1293
+ * - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
1294
+ * - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/plugins#-official-plugins full list of plugins and the methods they register}.
1295
+ */
1296
+ static register(plugin: ChronosPlugin): void;
1297
+ }
1298
+ //#endregion
1299
+ //#region src/types/chronos-statics.d.ts
1300
+ /** All the statics methods in `Chronos` class */
1301
+ interface ChronosStatics {
1302
+ /**
1303
+ * * Converts a date into a `Chronos` object and access to all `Chronos` methods and properties.
1304
+ *
1305
+ * @description
1306
+ * This function serves as a wrapper around the `Chronos` class constructor and allows you to create a new `Chronos` instance from various types of date representations.
1307
+ *
1308
+ * Accepts no arguments (defaults to now).
1309
+ *
1310
+ * @returns Instance of `Chronos` with all methods and properties.
1311
+ */
1312
+ (): Chronos;
1313
+ /**
1314
+ * * Converts a date into a `Chronos` object and access to all `Chronos` methods and properties.
1315
+ *
1316
+ * @description
1317
+ * This function serves as a wrapper around the `Chronos` class constructor and allows you to create a new `Chronos` instance from various types of date representations.
1318
+ *
1319
+ * @param value - A date value in `number`, it should be a timestamp (milliseconds since the Unix epoch).
1320
+ *
1321
+ * @returns Instance of `Chronos` with all methods and properties.
1322
+ */
1323
+ (value: number): Chronos;
1324
+ /**
1325
+ * * Converts a date into a `Chronos` object and access to all `Chronos` methods and properties.
1326
+ *
1327
+ * **Note**: *If a date is provided **without a time component**, the instance will default to `00:00:00.000` UTC
1328
+ * and convert it to the **equivalent local time** using the current environment's UTC offset.*
1329
+ *
1330
+ * @description
1331
+ * This function serves as a wrapper around the `Chronos` class constructor and allows you to create a new `Chronos` instance from various types of date representations.
1332
+ *
1333
+ * @param value - A date value in `string`, it should be in a format that can be parsed by the `Date` constructor.
1334
+ *
1335
+ * @returns Instance of `Chronos` with all methods and properties.
1336
+ */
1337
+ (value: string): Chronos;
1338
+ /**
1339
+ * * Converts a date into a `Chronos` object and access to all `Chronos` methods and properties.
1340
+ *
1341
+ * **Note**: *If a date is provided **without a time component**, the instance will default to `00:00:00.000` UTC
1342
+ * and convert it to the **equivalent local time** using the current environment's UTC offset.*
1343
+ *
1344
+ * @description
1345
+ * This function serves as a wrapper around the `Chronos` class constructor and allows you to create a new `Chronos` instance from various types of date representations.
1346
+ *
1347
+ * @param value - A date value as `Date` object, it will be used as is.
1348
+ *
1349
+ * @returns Instance of `Chronos` with all methods and properties.
1350
+ */
1351
+ (value: Date): Chronos;
1352
+ /**
1353
+ * * Converts a date into a `Chronos` object and access to all `Chronos` methods and properties.
1354
+ *
1355
+ * **Note**: *If a date is provided **without a time component**, the instance will default to `00:00:00.000` UTC
1356
+ * and convert it to the **equivalent local time** using the current environment's UTC offset.*
1357
+ *
1358
+ * @description
1359
+ * This function serves as a wrapper around the `Chronos` class constructor and allows you to create a new `Chronos` instance from various types of date representations.
1360
+ *
1361
+ * @param value - A date value as `Chronos` object.
1362
+ *
1363
+ * @returns Instance of `Chronos` with all methods and properties.
1364
+ */
1365
+ (value: Chronos): Chronos;
1366
+ /**
1367
+ * * Converts a date into a `Chronos` object and access to all `Chronos` methods and properties.
1368
+ *
1369
+ * @description
1370
+ * This function serves as a wrapper around the `Chronos` class constructor and allows you to create a new `Chronos` instance from various types of date representations.
1371
+ *
1372
+ * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99, year is assumed to be 1900 + year.
1373
+ * @param month The month as a number between 1 and 12 (January to December).
1374
+ * @param date The date as a number between 1 and 31.
1375
+ * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
1376
+ * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
1377
+ * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
1378
+ * @param ms A number from 0 to 999 that specifies the milliseconds.
1379
+ *
1380
+ * @returns Instance of `Chronos` with all methods and properties.
1381
+ */
1382
+ (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Chronos;
1383
+ /**
1384
+ * @static Injects a plugin into the `Chronos` system.
1385
+ * @param plugin The plugin to inject.
1386
+ *
1387
+ * @remarks
1388
+ * - Using this (`use`) method in `React` projects may trigger *linter error* like `"React Hooks must be called in a React function component or a custom React Hook function."`
1389
+ * - To prevent this incorrect *linter error* in `React` projects, prefer using {@link register} method (alias `use` method).
1390
+ *
1391
+ * - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
1392
+ * - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/plugins#-official-plugins full list of plugins and the methods they register}.
1393
+ */
1394
+ use(plugin: ChronosPlugin): void;
1395
+ /**
1396
+ * @static Registers a plugin into the `Chronos` system.
1397
+ * @param plugin The plugin to register.
1398
+ *
1399
+ * @remarks
1400
+ * - This is just an alias for {@link use} method.
1401
+ * - Using {@link use} method in `React` projects may trigger *linter error* like `"React Hooks must be called in a React function component or a custom React Hook function."`
1402
+ * - To prevent this incorrect *linter error* in `React` projects, prefer using this (`register`) method over {@link use} method.
1403
+ *
1404
+ * - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
1405
+ * - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/plugins#-official-plugins full list of plugins and the methods they register}.
1406
+ */
1407
+ register(plugin: ChronosPlugin): void;
1408
+ /**
1409
+ * * Returns the current date and time in a specified format in local time.
1410
+ * * Default format is dd, `MMM DD, YYYY HH:mm:ss` = `Sun, Apr 06, 2025 16:11:55`
1411
+ * @param options - Configure format string and whether to format using utc offset.
1412
+ * @returns Formatted date string in desired format.
1413
+ */
1414
+ today(options?: FormatOptions): string;
1415
+ /**
1416
+ * * Returns a new `Chronos` instance representing yesterday's date.
1417
+ *
1418
+ * @returns A `Chronos` instance for the next calendar day.
1419
+ */
1420
+ yesterday(): Chronos;
1421
+ /**
1422
+ * * Returns a new `Chronos` instance representing tomorrow's date.
1423
+ *
1424
+ * @returns A `Chronos` instance for the next calendar day.
1425
+ */
1426
+ tomorrow(): Chronos;
1427
+ /**
1428
+ * * Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
1429
+ * * It basically calls `Date.now()`.
1430
+ * @returns The number of milliseconds elapsed since the Unix epoch.
1431
+ */
1432
+ now(): number;
1433
+ /**
1434
+ * * Parses a date string with a given format (limited support only).
1435
+ *
1436
+ * * **Supported format tokens**:
1437
+ * - `YYYY`: Full year (e.g., 2023)
1438
+ * - `YY`: Two-digit year (e.g., 23 for 2023, 99 for 1999)
1439
+ * - `MM`: Month (01-12)
1440
+ * - `M`: 1-Digit Month (1-9)
1441
+ * - `DD`: Day of the month (01-31)
1442
+ * - `D`: 1-Digit Day of the month (1-9)
1443
+ * - `HH`: Hour (00-23)
1444
+ * - `H`: 1-Digit Hour (0-9)
1445
+ * - `mm`: Minute (00-59)
1446
+ * - `m`: 1-Digit Minute (0-9)
1447
+ * - `ss`: Second (00-59)
1448
+ * - `s`: 1-Digit Second (0-9)
1449
+ *
1450
+ * @example
1451
+ * Chronos.parse('23-12-31 15:30:45', 'YY-MM-DD HH:mm:ss');
1452
+ * // returns Chronos instance with the parsed date 2023-12-31T15:30:45
1453
+ *
1454
+ * @param dateStr - The date string to be parsed
1455
+ * @param format - The format of the date string. Tokens like `YYYY`, `MM`, `DD`, `HH`, `mm`, `ss` are used to specify the structure.
1456
+ * @returns A new `Chronos` instance representing the parsed date.
1457
+ * @throws `Error` If the date string does not match the format.
1458
+ */
1459
+ parse(dateStr: string, format: string): Chronos;
1460
+ /**
1461
+ * * Creates a new `Chronos` instance with the provided time component(s).
1462
+ *
1463
+ * @param options - One or more time components to override.
1464
+ * @returns A new `Chronos` instance with the provided time components applied.
1465
+ *
1466
+ * @remarks
1467
+ * - Unspecified components are filled with the current time's (`Chronos`) respective values.
1468
+ * - For option `month`, value should be number from `1` (January) to `12` (December).
1469
+ * - If the `date` component is omitted and the current day is the last day of its month,
1470
+ * the resulting instance will also use the last day of the target month.
1471
+ * - _This rule does **not** apply if the `date` component is explicitly provided,
1472
+ * even if that value exceeds the last day of the target month._
1473
+ *
1474
+ * @example
1475
+ * // Override only the year and month
1476
+ * const c = Chronos.with({ year: 2025, month: 12 });
1477
+ */
1478
+ with(options: ChronosWithOptions): Chronos;
1479
+ /**
1480
+ * * Creates a UTC-based Chronos instance.
1481
+ * If no date is provided, it uses the current date and time.
1482
+ *
1483
+ * **This is the base time, meaning conversion in other timezone will consider UTC time as the base time.**
1484
+ *
1485
+ * @param dateLike Optional input date to base the UTC time on.
1486
+ * If omitted, the current system date/time is used.
1487
+ * @returns A new Chronos instance representing the UTC equivalent of the input.
1488
+ */
1489
+ utc(dateLike?: ChronosInput): Chronos;
1490
+ /**
1491
+ * * Formats a time-only string into a formatted time string.
1492
+ *
1493
+ * @param time - Time string to be formatted. Supported formats include:
1494
+ * - `HH:mm` → e.g., `'14:50'`
1495
+ * - `HH:mm:ss` → e.g., `'14:50:00'`
1496
+ * - `HH:mm:ss.SSS` → e.g., `'14:50:00.800'`
1497
+ * - `HH:mm+TimeZoneOffset(HH)` → e.g., `'14:50+06'`
1498
+ * - `HH:mm:ss+TimeZoneOffset(HH)` → e.g., `'14:50:00+06'`
1499
+ * - `HH:mm:ss+TimeZoneOffset(HH:mm)` → e.g., `'14:50:00+05:30'`
1500
+ * - `HH:mm:ss.SSS+TimeZoneOffset(HH)` → e.g., `'14:50:00.800+06'`
1501
+ * - `HH:mm:ss.SSS+TimeZoneOffset(HH:mm)` → e.g., `'14:50:00.800+06:30'`
1502
+ *
1503
+ * * *Input will default to today's date and assume local timezone if no offset is provided.*
1504
+ *
1505
+ * @param format - Format string accepted by `formatStrict()` method (`TimeParts`). Default: `hh:mm:ss a` → 02:33:36 pm.
1506
+ * @returns Formatted time string in local (System) time.
1507
+ */
1508
+ formatTimePart(time: string, format?: TimeFormatToken): string;
1509
+ /**
1510
+ * * Returns ISO date strings for each occurrence of a weekday from today, spanning a relative time range.
1511
+ *
1512
+ * @param day - The weekday to match (e.g., `'Wednesday'`, `'Sunday'`).
1513
+ * @param options - Relative range (e.g., 7 days, 4 weeks) and output format (local with timezone or utc).
1514
+ * @returns Array of ISO date strings in the specified format. Returns empty array if no matches in the time span.
1515
+ *
1516
+ * @example
1517
+ * Chronos.getDatesForDay('Wednesday', { span: 7, unit: 'day' });
1518
+ * //=> [ '2025-05-28T21:16:06.198+06:00', '2025-06-04T21:16:06.198+06:00' ]
1519
+ *
1520
+ * @example
1521
+ * Chronos.getDatesForDay('Wednesday', {
1522
+ * span: 7,
1523
+ * unit: 'day',
1524
+ * format: 'utc'
1525
+ * });
1526
+ * //=> [ '2025-05-28T15:17:10.812Z', '2025-06-04T15:17:10.812Z' ]
1527
+ */
1528
+ getDatesForDay(day: WeekDay, options?: RelativeRangeOptions): string[];
1529
+ /**
1530
+ * * Returns ISO date strings for each occurrence of a weekday between two fixed dates.
1531
+ *
1532
+ * @param day - The weekday to match (e.g., `'Monday'`, `'Friday'`).
1533
+ * @param options - Absolute date range (e.g. `'2025-06-30'`, ` new Date()`, `new Chronos()` etc.) and output format (local with timezone or utc).
1534
+ * @returns Array of ISO date strings in the specified format. Returns empty array if no matches in the range.
1535
+ *
1536
+ * @example
1537
+ * Chronos.getDatesForDay('Monday', {
1538
+ * from: '2025-05-28',
1539
+ * to: '2025-06-30',
1540
+ * format: 'local'
1541
+ * });
1542
+ * //=> [ '2025-01-06T...', '2025-01-13T...', ... ]
1543
+ */
1544
+ getDatesForDay(day: WeekDay, options?: DateRangeOptions): string[];
1545
+ /**
1546
+ * * Returns ISO date strings for each occurrence of a weekday.
1547
+ *
1548
+ * @param day - The weekday to match (e.g., `'Wednesday'`, `'Sunday'`).
1549
+ * @param options - Relative range (e.g., 7 days, 4 weeks) or Absolute date range and output format.
1550
+ * @returns Array of ISO date strings in the specified format.
1551
+ */
1552
+ getDatesForDay(day: WeekDay, options?: WeekdayOptions): string[];
1553
+ /**
1554
+ * * Returns earliest Chronos
1555
+ * @param dates Date inputs.
1556
+ */
1557
+ min(...dates: ChronosInput[]): Chronos;
1558
+ /**
1559
+ * * Returns latest Chronos
1560
+ * @param dates Date inputs.
1561
+ */
1562
+ max(...dates: ChronosInput[]): Chronos;
1563
+ /**
1564
+ * * Checks if the year in the date string or year (from 0 - 9999) is a leap year.
1565
+ * - A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400.
1566
+ * - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not.
1567
+ *
1568
+ * @description
1569
+ * This method accepts different types of date inputs and extracts the year to check if it's a leap year.
1570
+ * If the provided date is a `number`, it will be treated as a year (must be a valid year from 0 to 9999).
1571
+ * If the year is out of this range (negative or larger than 9999), it will be treated as a Unix timestamp.
1572
+ * If the provided date is a string or a `Date` object, it will be parsed and the year will be extracted.
1573
+ * If a `Chronos` instance is passed, the year will be directly accessed from the instance.
1574
+ *
1575
+ * @param date - A `number` (year or Unix timestamp), `string`, `Date`, or `Chronos` instance representing a date.
1576
+ * @returns `true` if the year is a leap year, `false` otherwise.
1577
+ */
1578
+ isLeapYear(date: ChronosInput): boolean;
1579
+ /**
1580
+ * * Checks if the given value is a valid `Date` object.
1581
+ * - A value is considered valid if it is an instance of the built-in `Date` class.
1582
+ * - This does not check whether the date itself is valid (e.g., `new Date('invalid')`).
1583
+ * @param value - The value to test.
1584
+ * @returns `true` if the value is a valid Date object, otherwise `false`.
1585
+ */
1586
+ isValidDate(value: unknown): value is Date;
1587
+ /**
1588
+ * * Checks if the given value is a valid date string.
1589
+ * - A value is considered a valid date string if it is a string and can be parsed by `Date.parse()`.
1590
+ * - This uses the native JavaScript date parser internally.
1591
+ * @param value - The value to test.
1592
+ * @returns `true` if the value is a valid date string, otherwise `false`.
1593
+ */
1594
+ isDateString(value: unknown): value is string;
1595
+ /**
1596
+ * * Checks if the given value is an instance of `Chronos`.
1597
+ * - Useful for verifying Chronos objects in type guards or validations.
1598
+ * @param value - The value to test.
1599
+ * @returns `true` if the value is an instance of `Chronos`, otherwise `false`.
1600
+ */
1601
+ isValidChronos(value: unknown): value is Chronos;
1602
+ /**
1603
+ * * Checks if the given value has the necessary properties to be reconstructed into a `Chronos` instance.
1604
+ * - Can be used for validating objects that may represent serialized `Chronos` data.
1605
+ * @param value - The value to check.
1606
+ * @returns `true` if the value has the required properties for reconstruction, otherwise `false`.
1607
+ */
1608
+ isReconstructable(value: unknown): value is ChronosProperties;
1609
+ /**
1610
+ * * Reconstructs a `Chronos` instance from an object containing the necessary properties.
1611
+ * - The input object must have the properties defined in {@link ChronosProperties} interface.
1612
+ * - If the input is not reconstructable, an error is thrown.
1613
+ *
1614
+ * @param value - An object containing the properties required to reconstruct a `Chronos` instance.
1615
+ * @returns A new `Chronos` instance created from the provided properties.
1616
+ * @throws `TypeError` if the input value does not have the necessary properties for reconstruction.
1617
+ */
1618
+ reconstruct(value: ChronosProperties): Chronos;
1619
+ }
1620
+ //#endregion
1621
+ //#region src/types/date-time.d.ts
1622
+ /** - Represents the full name of a weekday, e.g., 'Monday', 'Tuesday' etc. */
1623
+ type WeekDay = (typeof DAYS)[number];
1624
+ /** - Represents the full name of a month, e.g., 'January', 'February' etc. */
1625
+ type MonthName = (typeof MONTHS)[number];
1626
+ /** Mapped type to {@link TIME_UNIT_VARIANTS} */
1627
+ type $TimeUnitVarMap = typeof TIME_UNIT_VARIANTS;
1628
+ /** Key of {@link TIME_UNIT_VARIANTS} */
1629
+ type $TimeUnitKey = keyof typeof TIME_UNIT_VARIANTS;
1630
+ /** Variants of different time units in lowercase */
1631
+ type $TimeUnitVar<U extends $TimeUnitKey = $TimeUnitKey> = $TimeUnitVarMap[U][number];
1632
+ /** Variants of different time units in lowercase, uppercase and capitalized */
1633
+ type $UnitAnyCase = Capitalize<$TimeUnitVar> | Uppercase<$TimeUnitVar> | $TimeUnitVar;
1634
+ /** Number (time value) with variants of different time units */
1635
+ type TimeWithUnit = `${number}${$UnitAnyCase}` | `${number} ${$UnitAnyCase}`;
1636
+ /** - Minute in numeric string from `00` to `23` */
1637
+ type ClockHour = `0${Enumerate<10>}` | `${NumberRange<10, 23>}`;
1638
+ /** - Minute in numeric string from `00` to `59` */
1639
+ type ClockMinute = `0${Enumerate<10>}` | `${NumberRange<10, 59>}`;
1640
+ /** - Second in numeric string from `00` to `59` */
1641
+ type ClockSecond = `0${Enumerate<10>}` | `${NumberRange<10, 59>}`;
1642
+ /** - Time in "HH:MM" format. */
1643
+ type ClockTime = `${ClockHour}:${ClockMinute}`;
1644
+ /** Normal time in `H:mm` format which does not follow the strict limit up to 23 hours, hour can be any number and minute can be numeric string from `00` to `59` */
1645
+ type HourMinutes = `${number}:${ClockMinute}`;
1646
+ /** Extends {@link Intl.DateTimeFormatOptions} with improved type system. */
1647
+ interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions {
1648
+ /** {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones Time zone identifier} to use (excluding `'Factory'`). */
1649
+ timeZone?: $TimeZoneIdentifier;
1650
+ /** Locale calendar system to use. */
1651
+ calendar?: LocaleCalendar;
1652
+ /** Locale numbering system to use. */
1653
+ numberingSystem?: NumberingSystem;
1654
+ }
1655
+ /** Millisecond from `0-999` */
1656
+ type Milliseconds = Enumerate<999> | 999;
1657
+ /** Date of the month as `0` padded numeric string e.g. `01`, `18` */
1658
+ type DateString = `0${NumberRange<1, 9>}` | `${NumberRange<10, 31>}`;
1659
+ /** Month as `0` padded numeric string, e.g. `02`, `01` etc. */
1660
+ type MonthString = `0${NumberRange<1, 9>}` | '10' | '11' | '12';
1661
+ /** Date and month in `MM-DD` format, e.g. `01-12` means 'January 18' */
1662
+ type MonthDateString = Exclude<`${MonthString}-${DateString}`, '02-30' | '02-31' | '04-31' | '06-31' | '09-31' | '11-31'>;
1663
+ /** Options for `formatDate` utility */
1664
+ interface DateFormatOptions extends FormatOptions {
1665
+ /** - Date to format, must be parsable by {@link Date} constructor. Can be string, number or `Date`. Defaults to current time. */
1666
+ date?: DateArgs;
1667
+ format?: StrictFormat;
1668
+ }
1669
+ /** Interface representing a date-like object. */
1670
+ interface DateLike {
1671
+ toJSON?(): string;
1672
+ toISOString?(): string;
1673
+ toString?(): string;
1674
+ format?(): string;
1675
+ toISO?(): string;
1676
+ toFormat?(format: string): string;
1677
+ plus?(...args: unknown[]): unknown;
1678
+ minus?(...args: unknown[]): unknown;
1679
+ equals?(...args: unknown[]): boolean;
1680
+ getClass?(): unknown;
1681
+ constructor?: {
1682
+ name: string;
1683
+ };
1684
+ }
1685
+ /** Quarters of the year */
1686
+ type Quarter = 1 | 2 | 3 | 4;
1687
+ /** Represents key of `ChronosStatics` (each static method and property) */
1688
+ type ChronosStaticKey = keyof ChronosStatics;
1689
+ /** Key of {@link TIME_ZONE_LABELS} ({@link UTCOffset}) */
1690
+ type $TZLabelKey = keyof typeof TIME_ZONE_LABELS;
1691
+ /** Abbreviated time zone names (from {@link https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations time zone abbreviations on Wikipedia}). */
1692
+ type TimeZone = keyof typeof TIME_ZONES;
1693
+ /** Time zone identifier (from {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones IANA TZ Database on Wikipedia}) excluding `'Factory'`. */
1694
+ type $TimeZoneIdentifier = Exclude<keyof typeof TIME_ZONE_IDS, 'Factory'>;
1695
+ /** Time zone identifier (from {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones IANA TZ Database on Wikipedia}) excluding `'Factory'` & abbreviations present in {@link TimeZone}. */
1696
+ type TimeZoneIdentifier = Exclude<$TimeZoneIdentifier, TimeZone>;
1697
+ /** Time zone identifier, array of timezone identifiers or UTC offset. */
1698
+ type TimeZoneId = $TimeZoneIdentifier | $TimeZoneIdentifier[] | UTCOffset;
1699
+ /** JavaScript native time zone identifier (from {@link Intl.supportedValuesOf} API) */
1700
+ type TimeZoneIdNative = keyof typeof TIME_ZONES_NATIVE;
1701
+ /** JavaScript native time zone name (from {@link Intl.supportedValuesOf} API) */
1702
+ type TimeZoneNameNative = (typeof TIME_ZONES_NATIVE)[TimeZoneIdNative]['tzName'];
1703
+ /** Native time zone name or IANA time zone identifier */
1704
+ type $NativeTzNameOrId = TimeZoneNameNative | $TimeZoneIdentifier;
1705
+ /** Full time zone names from {@link https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations Wikipedia}, {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones IANA TZ Database on Wikipedia} and JavaScript native API ({@link Intl.supportedValuesOf}). */
1706
+ type TimeZoneName = NonNullable<(typeof TIME_ZONE_LABELS)[$TZLabelKey] | (typeof TIME_ZONES)[TimeZone]['tzName'] | (typeof TIME_ZONE_IDS)[$TimeZoneIdentifier]['tzName'] | TimeZoneNameNative>;
1707
+ /** Positive UTC hours */
1708
+ type PositiveUTCHour = `+0${Enumerate<10>}` | `+${NumberRange<10, 14>}`;
1709
+ /** Negative UTC hours */
1710
+ type NegativeUTCHour = `-0${Enumerate<10>}` | `-${NumberRange<10, 14>}`;
1711
+ /** UTC Minutes as quarters */
1712
+ type UTCMinute = '00' | '15' | '30' | '45';
1713
+ /** UTC offset in `±HH:mm` format */
1714
+ type $UTCOffset = `${PositiveUTCHour | NegativeUTCHour}:${UTCMinute}`;
1715
+ /** UTC offset in `UTC±HH:mm` format */
1716
+ type UTCOffset = `UTC${$UTCOffset}`;
1717
+ /** GMT offset in `GMT±HH:mm` or simply `GMT` format */
1718
+ type $GMTOffset = `GMT${$UTCOffset}` | 'GMT';
1719
+ type $ISOTimeString = `${number}-${number}-${number}T${number}:${number}:${number}.${number}`;
1720
+ type ISODateTimeString = `${$ISOTimeString}Z`;
1721
+ /** ISO timestamp string type in ISO 8601 format */
1722
+ type ISOTimeString = `${$ISOTimeString}${'Z' | $UTCOffset}`;
1723
+ /** Valid argument type accepted by `Date` constructor */
1724
+ type DateArgs = string | number | Date;
1725
+ /** Type for ISO date format options */
1726
+ type ISODateFormat = 'local' | 'utc';
1727
+ /** Options for `getTimestamp` utility */
1728
+ interface TimestampOptions {
1729
+ /**
1730
+ * Optional date input (string, number, or `Date` object).
1731
+ * Defaults to {@link Date new Date()}.
1732
+ */
1733
+ value?: DateArgs;
1734
+ /**
1735
+ * Output format for the timestamp.
1736
+ * - `'utc'` (default) → returns ISO string in UTC (`...Z`).
1737
+ * - `'local'` → returns ISO string with current system offset (`...+05:30`).
1738
+ */
1739
+ format?: ISODateFormat;
1740
+ }
1741
+ /** `Chronos` Date Format options */
1742
+ interface FormatOptions {
1743
+ /**
1744
+ * * The desired format (Default format is `'dd, mmm DD, YYYY HH:mm:ss'` = `'Sun, Apr 06, 2025 16:11:55'`).
1745
+ *
1746
+ * - To output raw text (i.e., not interpreted as a date token), wrap it in square brackets.
1747
+ * - For example, `[Today is] ddd` results in `Today is Sunday`, and `YYYY[ year]` results in `2025 year`.
1748
+ *
1749
+ * - Supported format tokens include: `YYYY`, `YY`, `mmmm`, `mmm`, `MM`, `M`, `DD`, `D`, `dd`, `ddd`, `Do`, `HH`, `H`, `hh`, `h`, `mm`, `m`, `ss`, `s`, `ms`, `mss`, `a`, `A`, and `ZZ`.
1750
+ * - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
1751
+ * - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/format#format-tokens format tokens} for details.
1752
+ */
1753
+ format?: string;
1754
+ /** - Whether to use UTC time. Defaults to `false`. */
1755
+ useUTC?: boolean;
1756
+ }
1757
+ /** - Configuration options for greeting. */
1758
+ interface GreetingConfigs {
1759
+ /** Time when the morning period ends (HH:MM format). Defaults to `11:59` */
1760
+ morningEnds?: ClockTime;
1761
+ /** Time when the noon period ends (HH:MM format). Defaults to `12:59` */
1762
+ noonEnds?: ClockTime;
1763
+ /** Time when the afternoon period ends (HH:MM format). Defaults to `17:59` */
1764
+ afternoonEnds?: ClockTime;
1765
+ /** Time when the evening period ends (HH:MM format). Defaults to `23:59` */
1766
+ eveningEnds?: ClockTime;
1767
+ /** Time when the midnight period ends (HH:MM format). Defaults to `02:59` */
1768
+ midnightEnds?: ClockTime;
1769
+ /** Current time in "HH:MM" format for some weird reason. Defaults to current time `new Date()` */
1770
+ currentTime?: ClockTime;
1771
+ /** Optional string to append after each message */
1772
+ appendToMsg?: string;
1773
+ /** Optional string to prepend before each message */
1774
+ prependToMsg?: string;
1775
+ /** Custom greeting message for the morning period. */
1776
+ morningMessage?: string;
1777
+ /** Custom greeting message for the noon period. */
1778
+ noonMessage?: string;
1779
+ /** Custom greeting message for the afternoon period. */
1780
+ afternoonMessage?: string;
1781
+ /** Custom greeting message for the evening period. */
1782
+ eveningMessage?: string;
1783
+ /** Custom greeting message for the midnight period. */
1784
+ midnightMessage?: string;
1785
+ /** Default greeting message if no period matches. */
1786
+ defaultMessage?: string;
1787
+ }
1788
+ /** Time zone details object */
1789
+ type TimeZoneDetails = {
1790
+ /** IANA time zone identifier */tzIdentifier: $TimeZoneIdentifier; /** Long localized form (e.g., `'Pacific Standard Time'`, `'Nordamerikanische Westküsten-Normalzeit'`) */
1791
+ tzNameLong: Maybe<LooseLiteral<TimeZoneName>>; /** Long generic non-location format (e.g.: `'Pacific Time'`, `'Nordamerikanische Westküstenzeit'`) */
1792
+ tzNameLongGeneric: Maybe<LooseLiteral<TimeZoneName>>; /** Long localized GMT format, prefixed with `"GMT"` (e.g., `"GMT-08:00"`) */
1793
+ tzNameLongOffset: Maybe<LooseLiteral<$GMTOffset>>;
1794
+ };
1795
+ /** Name of time unit from `year` to `millisecond` */
1796
+ type TimeUnit = 'year' | 'month' | 'day' | 'week' | 'hour' | 'minute' | 'second' | 'millisecond';
1797
+ /** Name of time unit from `year` to `millisecond`, excluding `week` */
1798
+ type FromNowUnit = Exclude<TimeUnit, 'week'>;
1799
+ /** Conditional value for {@link TimeUnit} */
1800
+ type TimeUnitValue<Unit extends TimeUnit> = Unit extends 'month' ? NumberRange<1, 12> : Unit extends 'week' ? NumberRange<1, 53> : Unit extends 'day' ? NumberRange<1, 31> : Unit extends 'hour' ? Enumerate<24> : Unit extends 'minute' | 'second' ? Enumerate<60> : Unit extends 'millisecond' ? Milliseconds : number;
1801
+ /** Unit suffix for {@link Date} getter methods (e.g., `'FullYear'` in `'getFullYear'`, `'Month'` in `'getMonth'` etc.). */
1802
+ type $DateUnit = 'FullYear' | 'Month' | 'Day' | 'Date' | 'Hours' | 'Minutes' | 'Seconds' | 'Milliseconds';
1803
+ /** `BCP47` locale string or {@link Intl.Locale} object that contain one or more language or locale tags */
1804
+ type $LocalArguments = LooseLiteral<LocaleCode | Split<LocaleCode, '-'>[0]> | Intl.Locale;
1805
+ /** `BCP47` locale string, array of locale strings, {@link Intl.Locale} object, or array of {@link Intl.Locale} objects that contain one or more language or locale tags. */
1806
+ type LocalesArguments = $LocalArguments | $LocalArguments[];
1807
+ /** Locale calendars supported by {@link Intl} API */
1808
+ type LocaleCalendar = (typeof LOCALE_CALENDARS)[number];
1809
+ /** Locale numbering systems supported by {@link Intl} API */
1810
+ type NumberingSystem = (typeof LOCALE_NUMBERING_SYSTEMS)[number];
1811
+ //#endregion
1812
+ //#region src/types/chronos-specific.d.ts
1813
+ /**
1814
+ * * Options for `Chronos` _static_ method `with()`
1815
+ *
1816
+ * @remarks Should provide at least one property, otherwise use the current date and time.
1817
+ */
1818
+ type ChronosWithOptions = Partial<{
1819
+ /** The full year (e.g., 2025). Years 0–99 are interpreted as 1900–1999. */year: number; /** Month number from 1 (January) to 12 (December). */
1820
+ month: NumberRange<1, 12>; /** Day of the month, from 1 to 31. */
1821
+ date: NumberRange<1, 31>; /** Hour of the day, from 0 (midnight) to 23 (11 PM). */
1822
+ hour: Enumerate<24>; /** Minutes of the hour, from 0 to 59. */
1823
+ minute: Enumerate<60>; /** Seconds of the minute, from 0 to 59. */
1824
+ second: Enumerate<60>; /** Milliseconds of the second, from 0 to 999. */
1825
+ millisecond: Milliseconds;
1826
+ }>;
1827
+ /** Interface for accessing internal private properties in extended `Chronos` class */
1828
+ interface ChronosInternals {
1829
+ /**
1830
+ * * Access to `#withOrigin` private method.
1831
+ * * Creates a new `Chronos` instance with `origin` and other properties.
1832
+ *
1833
+ * @param instance The `Chronos` instance to which attach the `origin` and other properties.
1834
+ * @param origin Origin of the instance, the method name from where it was created.
1835
+ * @param offset Optional UTC offset in `UTC±HH:mm` format.
1836
+ * @param tzName Optional time zone name to set.
1837
+ * @param tzId Optional time zone identifier(s) to set.
1838
+ * @param tzTracker Optional tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/conversion#timezone timeZone} method.
1839
+ * @returns The `Chronos` instance with the specified origin and other properties.
1840
+ */
1841
+ withOrigin(instance: Chronos, method: PluginMethods, offset?: UTCOffset, tzName?: LooseLiteral<TimeZoneName>, tzId?: TimeZoneId, tzTracker?: $TimeZoneIdentifier | TimeZone | UTCOffset): Chronos;
1842
+ /**
1843
+ * * Access to `#toNewDate` private method
1844
+ * * Creates a new `Date` object from a `Chronos` input
1845
+ * @param instance - `Chronos` instance to operate on
1846
+ * @param value - Input value to convert (optional, uses current date if omitted)
1847
+ * @returns A new JavaScript `Date` object
1848
+ */
1849
+ toNewDate(instance: Chronos, value?: ChronosInput): Date;
1850
+ /**
1851
+ * * Gets the internal `#date`, a readonly private property (core `Date` object)
1852
+ * @param instance - `Chronos` instance to access
1853
+ * @returns The core internal `Date` object
1854
+ */
1855
+ internalDate(instance: Chronos): Date;
1856
+ /**
1857
+ * * Gets current UTC Offset internally stored as `#offset` private property
1858
+ * @param instance - `Chronos` instance to access
1859
+ * @returns The stored formatted UTC offset
1860
+ */
1861
+ offset(instance: Chronos): UTCOffset;
1862
+ /** * Ensures the input is a `Chronos` instance, creating one if necessary. */
1863
+ cast(date: ChronosInput): Chronos;
1864
+ }
1865
+ /** @internal Helper type to assign instance origin when creating new `Chronos` instance. */
1866
+ type WithoutOrigin = Omit<Chronos, '#ORIGIN' | 'origin'>;
1867
+ /** Alias for `typeof Chronos` */
1868
+ type $Chronos = typeof Chronos;
1869
+ /** * Instance methods that return `Chronos` instance */
1870
+ type $InstanceMethods = { [Method in keyof WithoutOrigin]: Chronos extends { [Instance in Method]: (...args: any[]) => Chronos } ? Method : never }[keyof WithoutOrigin];
1871
+ /** * Static methods that return `Chronos` instance */
1872
+ type $StaticMethods = { [Method in keyof $Chronos]: $Chronos extends { [Instance in Method]: (...args: any[]) => Chronos } ? Method : never }[keyof $Chronos];
1873
+ /** * Plugin methods that return `Chronos` instance */
1874
+ type $PluginMethods = 'round' | `timeZone` | 'nextWorkday' | 'nextWeekend' | 'previousWorkday' | 'previousWeekend';
1875
+ /** * Plugin methods that return `Chronos` instance + any custom name */
1876
+ type PluginMethods = LooseLiteral<$PluginMethods>;
1877
+ /** Both instance and static methods (including built-in plugin methods) in `Chronos` class that return `Chronos` instance. */
1878
+ type ChronosMethods = $InstanceMethods | $StaticMethods | $PluginMethods;
1879
+ /**
1880
+ * * Accepted Input type for `Chronos`
1881
+ *
1882
+ * **Note**: *If a date is provided **without a time component**, the instance will default to `00:00:00.000` UTC
1883
+ * and convert it to the **equivalent local time** using the current environment's UTC offset.*
1884
+ */
1885
+ type ChronosInput = number | string | Date | Chronos;
1886
+ /** Properties required to reconstruct a `Chronos` instance. */
1887
+ interface ChronosProperties {
1888
+ /** The method or plugin name from which the instance was created. */
1889
+ origin: LooseLiteral<ChronosMethods>;
1890
+ /** The native date value, either as a `Date` object or a date string. */
1891
+ native: Date | string;
1892
+ /** The UTC offset in `UTC±HH:mm` format. */
1893
+ utcOffset: UTCOffset;
1894
+ /** The full time zone name (e.g., `"Pacific Standard Time"`). */
1895
+ timeZoneName: LooseLiteral<TimeZoneName>;
1896
+ /** The time zone identifier(s) associated with the instance (e.g., `"Asia/Dhaka"`). */
1897
+ timeZoneId: TimeZoneId;
1898
+ /** Optional tracker to identify the instance created by `timeZone` method. */
1899
+ $tzTracker?: $TimeZoneIdentifier | TimeZone | UTCOffset;
1900
+ }
1901
+ /** Iterable `Chronos` object properties */
1902
+ interface ChronosObject {
1903
+ /** Full year (e.g., 2025). */
1904
+ year: number;
1905
+ /** Month index starting from 0 (January = 0). */
1906
+ month: Enumerate<12>;
1907
+ /** ISO month number starting from 1 (January = 1). */
1908
+ isoMonth: NumberRange<1, 12>;
1909
+ /** Day of the month (1–31). */
1910
+ date: NumberRange<1, 31>;
1911
+ /** Day of the week index (0–6, Sunday = 0). */
1912
+ weekDay: Enumerate<7>;
1913
+ /** ISO day of the week number (1–7, Monday = 1). */
1914
+ isoWeekDay: NumberRange<1, 7>;
1915
+ /** Hour of the day (0–23). */
1916
+ hour: Enumerate<24>;
1917
+ /** Minute of the hour (0–59). */
1918
+ minute: Enumerate<60>;
1919
+ /** Second of the minute (0–59). */
1920
+ second: Enumerate<60>;
1921
+ /** Milliseconds within the second. */
1922
+ millisecond: Milliseconds;
1923
+ /** Timestamp in milliseconds since the Unix epoch. */
1924
+ timestamp: number;
1925
+ /** Unix timestamp in seconds since the epoch. */
1926
+ unix: number;
1927
+ }
1928
+ /** Common options for formatting and rounding dates */
1929
+ interface $CommonRangeOptions {
1930
+ /** - Output format: return ISO strings in `'local'` or `'utc'` format. Defaults to `'local'`. */
1931
+ format?: ISODateFormat;
1932
+ /** - Whether to round the dates in the range to the start of the day. Default is `false`. */
1933
+ roundDate?: boolean;
1934
+ }
1935
+ /** - Options to define a **fixed date range** using explicit `from` and `to` dates. */
1936
+ interface DateRangeOptions extends $CommonRangeOptions {
1937
+ /** - Start date of the range (inclusive). Defaults to **now** if not provided. */
1938
+ from?: ChronosInput;
1939
+ /** - End date of the range (inclusive). Defaults to **4 weeks from now** if not provided. */
1940
+ to?: ChronosInput;
1941
+ }
1942
+ /** - Options to define a **relative date range** starting from the current date. */
1943
+ interface RelativeRangeOptions extends $CommonRangeOptions {
1944
+ /**
1945
+ * The number of time units to move **forward from `now`**.
1946
+ *
1947
+ * - Determines the size of the range.
1948
+ * - `now` → `start`, and `start + span` → `end`.
1949
+ * - Both `start` and `end` are included in the result.
1950
+ * - Controlled by the {@link unit} option.
1951
+ * - Defaults to `4`.
1952
+ */
1953
+ span?: number;
1954
+ /**
1955
+ * The time unit used to advance the range.
1956
+ *
1957
+ * - Works together with {@link span} to calculate the final date range.
1958
+ * - For example: `span: 2, unit: 'week'` → 2-week range.
1959
+ * - Defaults to `'week'`.
1960
+ */
1961
+ unit?: 'year' | 'month' | 'week' | 'day';
1962
+ }
1963
+ /** - Unified type that supports either a fixed or relative date range configuration. */
1964
+ type WeekdayOptions = RelativeRangeOptions | DateRangeOptions;
1965
+ /** Common options to either skip or keep days */
1966
+ interface $SkipOrKeepDays {
1967
+ /**
1968
+ * An array of weekdays to exclude from the date range.
1969
+ * - Accepts either weekday names (e.g., `'Saturday'`, `'Sunday'`) or numeric indices (0 for Sunday to 6 for Saturday).
1970
+ * - Ignored if {@link onlyDays} is provided.
1971
+ *
1972
+ * @example
1973
+ * skipDays: ['Saturday', 'Sunday']
1974
+ * skipDays: [0, 6] // Sunday and Saturday
1975
+ */
1976
+ skipDays?: Array<WeekDay> | Array<Enumerate<7>>;
1977
+ /**
1978
+ * An array of weekdays to explicitly include in the date range.
1979
+ * - Accepts either weekday names (e.g., `'Monday'`, `'Wednesday'`) or numeric indices (0 for Sunday to 6 for Saturday).
1980
+ * - When provided, this overrides {@link skipDays} and includes only the specified days.
1981
+ *
1982
+ * @example
1983
+ * onlyDays: ['Monday', 'Wednesday']
1984
+ * onlyDays: [1, 3] // Monday and Wednesday
1985
+ */
1986
+ onlyDays?: Array<WeekDay> | Array<Enumerate<7>>;
1987
+ }
1988
+ /** - Options to define a **fixed date range** using explicit `from` and `to` dates. */
1989
+ interface RangeWithDates extends DateRangeOptions, $SkipOrKeepDays {}
1990
+ /** - Options to define a **relative date range** starting from the current date. */
1991
+ interface RelativeDateRange extends RelativeRangeOptions, $SkipOrKeepDays {}
1992
+ /** - Unified type that supports either a fixed or relative date range configuration. */
1993
+ type DatesInRangeOptions = RangeWithDates | RelativeDateRange;
1994
+ //#endregion
1995
+ //#region src/types/chronos-plugins.d.ts
1996
+ /** * A plugin that augments the `Chronos` class with methods or properties. */
1997
+ type ChronosPlugin = (Chronos: $Chronos) => void;
1998
+ /** ISO date-based range (format: `MM-DD`) e.g. `01-14` for 'January 14' */
1999
+ type DateBoundary = {
2000
+ /** Start date in `MM-DD` format, e.g. `01-18` means 'January 18' */startDate: MonthDateString; /** End date in `MM-DD` format, e.g. `03-17` means 'March 17' */
2001
+ endDate: MonthDateString;
2002
+ };
2003
+ /** Inclusive month index-based range `0-11` (0 = January) */
2004
+ type MonthBoundary = {
2005
+ startMonth: Enumerate<12>;
2006
+ endMonth: Enumerate<12>;
2007
+ };
2008
+ /** Season definition for season configuration */
2009
+ interface SeasonDefinition {
2010
+ /** Name of the season */
2011
+ name: string;
2012
+ /** Inclusive date/month boundary of the season */
2013
+ boundary: MonthBoundary | DateBoundary;
2014
+ }
2015
+ /** Name of a predefined season preset */
2016
+ type SeasonPreset = keyof typeof SEASON_PRESETS;
2017
+ /** Options for configuring seasons */
2018
+ interface SeasonOptions {
2019
+ /** Custom season list to override or define seasons manually */
2020
+ seasons?: SeasonDefinition[];
2021
+ /** Predefined preset to use for season calculation */
2022
+ preset?: SeasonPreset;
2023
+ }
2024
+ interface $BusinessHourBaseOptions {
2025
+ /** - Optional starting hour of business time (0–23). Defaults to `9` (9 AM). */
2026
+ businessStartHour?: Enumerate<24>;
2027
+ /** - Optional ending hour of business time (0–23). Defaults to `17` (5 PM). */
2028
+ businessEndHour?: Enumerate<24>;
2029
+ }
2030
+ /** Options for configuring business hour with `weekStartsOn` and `weekendLength` */
2031
+ interface BusinessOptionsBasic extends $BusinessHourBaseOptions {
2032
+ /** - Optional day the week starts on (0–6). Default is `0` (Sunday). */
2033
+ weekStartsOn?: Enumerate<7>;
2034
+ /** - Optional weekend length (1-4). Default is `2`.*/
2035
+ weekendLength?: NumberRange<1, 4>;
2036
+ }
2037
+ /** Options for configuring business hour with `weekendDays` tuple */
2038
+ interface BusinessOptionsWeekends extends $BusinessHourBaseOptions {
2039
+ /** - Tuple of indices (0-6) of weekend days. Can pass only 1-4 elements. Default is `undefined`. */
2040
+ weekendDays?: RangeTuple<Enumerate<7>, 1, 4>;
2041
+ }
2042
+ /** Options for configuring business hour */
2043
+ type $BusinessHourOptions = BusinessOptionsBasic | BusinessOptionsWeekends;
2044
+ /** Names of standard Zodiac signs */
2045
+ type ZodiacSign = (typeof WESTERN_ZODIAC_SIGNS)[number][0];
2046
+ /** Presets for Zodiac Sign Configuration */
2047
+ type ZodiacPreset = keyof typeof ZODIAC_PRESETS;
2048
+ /** Shape of Zodiac signs array */
2049
+ type ZodiacArray<Sign extends string = ZodiacSign> = Array<[Sign, [NumberRange<1, 12>, NumberRange<1, 31>]] | Readonly<[Sign, Readonly<[NumberRange<1, 12>, NumberRange<1, 31>]>]>>;
2050
+ /** Zodiac metadata options */
2051
+ interface ZodiacMetaOptions<Sign extends string = ZodiacSign> {
2052
+ /**
2053
+ * Optional Zodiac preset to use. Default is `western`.
2054
+ * - **Note:** `western` and `tropical`, `vedic` and `sidereal` are same.
2055
+ */
2056
+ preset?: ZodiacPreset;
2057
+ /** Custom Zodiac date ranges, overrides {@link preset presets}. */
2058
+ custom?: ZodiacArray<Sign> | Readonly<ZodiacArray<Sign>>;
2059
+ }
2060
+ /** Options for configuring Zodiac sign getter */
2061
+ interface ZodiacOptions<Sign extends string = ZodiacSign> extends ZodiacMetaOptions<Sign> {
2062
+ /** - Optional birthdate in `MM-DD` format (`1`-based month). */
2063
+ birthDate?: MonthDateString;
2064
+ }
2065
+ /** Represents resolved metadata for a zodiac sign */
2066
+ interface ZodiacMeta<Sign extends string = ZodiacSign> {
2067
+ /**
2068
+ * Index (`0`-based) of the zodiac sign within the resolved and chronologically sorted zodiac list.
2069
+ *
2070
+ * ⚠️ **Notes:**
2071
+ * - The `index` is determined by the Gregorian month–day order of zodiac start dates and may differ between variants (e.g. Western vs Vedic).
2072
+ * - This `index` should not be interpreted as a traditional or mythological zodiac ordering.
2073
+ */
2074
+ index: number;
2075
+ /** The zodiac sign name. */
2076
+ sign: Sign;
2077
+ /** Inclusive start date of the zodiac sign in `MM-DD` format. */
2078
+ start: MonthDateString;
2079
+ /** Inclusive end date of the zodiac sign in `MM-DD` format. */
2080
+ end: MonthDateString;
2081
+ }
2082
+ /** Definition of day part names. */
2083
+ type DayPart = (typeof DATE_PARTS)[number];
2084
+ /** Object type for extracting day parts. */
2085
+ type DayPartConfig = Partial<Record<DayPart, [ClockHour, ClockHour]>>;
2086
+ /** Academic year, e.g. `2024-2025` */
2087
+ type AcademicYear = `${number}-${number}`;
2088
+ /** Return object type of `duration` method of `Chronos`. */
2089
+ interface TimeDuration {
2090
+ /** Total number of years. */
2091
+ years: number;
2092
+ /** Number of months remaining after full years are counted. */
2093
+ months: number;
2094
+ /** Number of days remaining after full months are counted. */
2095
+ days: number;
2096
+ /** Number of hours remaining after full days are counted. */
2097
+ hours: number;
2098
+ /** Number of minutes remaining after full hours are counted. */
2099
+ minutes: number;
2100
+ /** Number of seconds remaining after full minutes are counted. */
2101
+ seconds: number;
2102
+ /** Number of milliseconds remaining after full seconds are counted. */
2103
+ milliseconds: number;
2104
+ }
2105
+ /** Key of {@link TimeDuration} */
2106
+ type DurationKey = keyof TimeDuration;
2107
+ /** Options for formatting duration string */
2108
+ interface DurationOptions {
2109
+ /** The time to compare with. Defaults to `now`. */
2110
+ toTime?: ChronosInput;
2111
+ /** If true, returns all values as positive numbers. Defaults to `true`. */
2112
+ absolute?: boolean;
2113
+ /** Maximum number of units to display, e.g. 2 → "1 hour, 20 minutes" */
2114
+ maxUnits?: NumberRange<1, 7>;
2115
+ /** Separator between units (default: `", "`) */
2116
+ separator?: string;
2117
+ /** Display mode: `"full"` (default) → "2 hours", `"short"` → "2h" */
2118
+ style?: 'full' | 'short';
2119
+ /** Whether to include zero values (default: `false`) */
2120
+ showZero?: boolean;
2121
+ }
2122
+ //#endregion
2123
+ export { ChronosStaticKey as $, BanglaDateOptions as $t, ChronosObject as A, TimeZoneDetails as At, WithoutOrigin as B, ChronosStatics as Bt, $Chronos as C, Numeric as Cn, NumberingSystem as Ct, ChronosInput as D, RangeTuple as Dn, TimeUnitValue as Dt, $StaticMethods as E, LooseLiteral as En, TimeUnit as Et, PluginMethods as F, TimeZoneNameNative as Ft, $NativeTzNameOrId as G, $BanglaYear as Gt, $GMTOffset as H, chronos as Ht, RangeWithDates as I, TimestampOptions as It, $TimeUnitVar as J, $BnMonthPadded as Jt, $TZLabelKey as K, $BnDatePadded as Kt, RelativeDateRange as L, UTCMinute as Lt, ChronosWithOptions as M, TimeZoneIdNative as Mt, DateRangeOptions as N, TimeZoneIdentifier as Nt, ChronosInternals as O, TimeWithUnit as Ot, DatesInRangeOptions as P, TimeZoneName as Pt, $UnitAnyCase as Q, BanglaDateObject as Qt, RelativeRangeOptions as R, UTCOffset as Rt, ZodiacSign as S, Maybe as Sn, NegativeUTCHour as St, $PluginMethods as T, NumberRange as Tn, Quarter as Tt, $ISOTimeString as U, $BanglaMonth as Ut, $DateUnit as V, Chronos as Vt, $LocalArguments as W, $BanglaMonthDate as Wt, $TimeZoneIdentifier as X, BanglaDate as Xt, $TimeUnitVarMap as Y, $BnYearPadded as Yt, $UTCOffset as Z, BanglaDateFormat as Zt, ZodiacArray as _, StrictFormat as _n, LocalesArguments as _t, BusinessOptionsWeekends as a, BnCalendarConfig as an, DateFormatOptions as at, ZodiacOptions as b, TimeToken as bn, MonthName as bt, DayPart as c, DateFormatToken as cn, DateTimeFormatOptions as ct, DurationOptions as d, FormatToken as dn, GreetingConfigs as dt, BanglaDayName as en, ClockHour as et, MonthBoundary as f, HourToken as fn, HourMinutes as ft, TimeDuration as g, SecondToken as gn, LocaleCalendar as gt, SeasonPreset as h, MonthToken as hn, ISOTimeString as ht, BusinessOptionsBasic as i, BanglaYear as in, DateArgs as it, ChronosProperties as j, TimeZoneId as jt, ChronosMethods as k, TimeZone as kt, DayPartConfig as l, DateToken as ln, FormatOptions as lt, SeasonOptions as m, MinuteToken as mn, ISODateTimeString as mt, $BusinessHourOptions as n, BanglaMonthName as nn, ClockSecond as nt, ChronosPlugin as o, BnCalendarVariant as on, DateLike as ot, SeasonDefinition as p, MSToken as pn, ISODateFormat as pt, $TimeUnitKey as q, $BnEn as qt, AcademicYear as r, BanglaSeasonName as rn, ClockTime as rt, DateBoundary as s, DateWithSeasonToken as sn, DateString as st, $BusinessHourBaseOptions as t, BanglaMonth as tn, ClockMinute as tt, DurationKey as u, DayToken as un, FromNowUnit as ut, ZodiacMeta as v, TimeFormatToken as vn, Milliseconds as vt, $InstanceMethods as w, Enumerate as wn, PositiveUTCHour as wt, ZodiacPreset as x, YearToken as xn, MonthString as xt, ZodiacMetaOptions as y, TimeOnlyFormat as yn, MonthDateString as yt, WeekdayOptions as z, WeekDay as zt };