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,225 @@
1
+ import { $t as BanglaDateOptions, C as $Chronos, Gt as $BanglaYear, Qt as BanglaDateObject, Ut as $BanglaMonth, Wt as $BanglaMonthDate, _n as StrictFormat, an as BnCalendarConfig, en as BanglaDayName, nn as BanglaMonthName, qt as $BnEn, rn as BanglaSeasonName } from "../types-DPTQ_yLx.cjs";
2
+
3
+ //#region src/plugins/banglaPlugin.d.ts
4
+ declare module '../' {
5
+ interface Chronos {
6
+ /**
7
+ * @instance Converts the current date to a complete Bangla calendar date object.
8
+ *
9
+ * @param options - Configuration options for the Bangla date output
10
+ * @returns A complete Bangla date object containing year, month, date, names, and leap year status
11
+ *
12
+ * @example
13
+ * Chronos.register(banglaPlugin);
14
+ *
15
+ * const chronos = new Chronos('2023-04-14');
16
+ * const banglaDate = chronos.toBangla();
17
+ * // Returns: {
18
+ * // year: '১৪৩০',
19
+ * // month: '১',
20
+ * // date: '১',
21
+ * // monthName: 'বৈশাখ',
22
+ * // dayName: 'শুক্রবার',
23
+ * // seasonName: 'গ্রীষ্ম',
24
+ * // isLeapYear: false
25
+ * // }
26
+ *
27
+ * const banglaDateEn = chronos.toBangla({ locale: 'en' });
28
+ * // Returns: {
29
+ * // year: 1430,
30
+ * // month: 1,
31
+ * // date: 1,
32
+ * // monthName: 'Boishakh',
33
+ * // dayName: 'Shukrobar (Friday)',
34
+ * // seasonName: 'Grisma (Summer)',
35
+ * // isLeapYear: false
36
+ * // }
37
+ *
38
+ * @remarks
39
+ * - The method uses the default calendar variant unless specified in options.
40
+ * - The locale option determines whether values are returned in Bangla or Latin format.
41
+ */
42
+ toBangla<Locale extends $BnEn = 'bn'>(options?: BanglaDateOptions<Locale>): BanglaDateObject<Locale>;
43
+ /**
44
+ * @instance Formats the current date as a Bangla calendar date string using customizable tokens.
45
+ *
46
+ * @param format - Format string using tokens (default: `'ddd, DD mmmm (SS), YYYY বঙ্গাব্দ - hh:mm:ss (A)'`)
47
+ * @param options - Calendar configuration options
48
+ * @returns Formatted Bangla date string according to the specified format
49
+ *
50
+ * @example
51
+ * const chronos = new Chronos('2023-04-14 14:30:00');
52
+ * chronos.formatBangla();
53
+ * // Returns: 'শুক্রবার, বৈশাখ ০১ (গ্রীষ্মকাল), ১৪৩০ বঙ্গাব্দ - ০২:৩০:০০ (অপরাহ্ণ)'
54
+ *
55
+ * chronos.formatBangla('YYYY-MM-DD');
56
+ * // Returns: '১৪৩০-০১-০১'
57
+ *
58
+ * chronos.formatBangla('mmmm DD, YYYY');
59
+ * // Returns: 'বৈশাখ ০১, ১৪৩০'
60
+ *
61
+ * chronos.formatBangla('hh:mm:ss A');
62
+ * // Returns: '০২:৩০:০০ অপরাহ্ণ'
63
+ *
64
+ * @remarks
65
+ * - 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`, `Z`. `SS`, `S` and.
66
+ * - **Year**: `YYYY/yyyy` (full year), `YY/yy` (last 2 digits)
67
+ * - **Month**: `M/MM`(padded), `mmm` (short name), `mmmm` (full name)
68
+ * - **Day**: `D/DD`(padded), Do (results same as cardinal for Bangla dates)
69
+ * - **Weekday**: `d` (short), `dd` (without 'বার'), `ddd` (full)
70
+ * - **Time**: `H/HH` (24h), `h/hh` (12h), `m/mm` (minute), `s/ss` (second), `ms/mss` (millisecond)
71
+ * - **Period**: `a/A` (am/pm => পূর্বাহ্ণ/অপরাহ্ণ )
72
+ * - **Timezone**: `Z/ZZ` (offset)
73
+ * - **Season**: `S` (season), `SS` (season with 'কাল' suffix)
74
+ * - To output raw text (i.e., not interpreted as a date token), wrap it in square brackets.
75
+ * - For example, `[আজ] ddd` results in `আজ রবিবার`, and `[year ]YYYY` results in `year ২০২৫`.
76
+ * - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
77
+ */
78
+ formatBangla(format?: StrictFormat, options?: BnCalendarConfig): string;
79
+ /**
80
+ * @instance Gets the Bangla calendar year for the current date.
81
+ *
82
+ * @param locale - Output locale ('bn' for Bangla digits, 'en' for Latin digits)
83
+ * @returns Bangla year in the specified locale format
84
+ *
85
+ * @example
86
+ * const chronos = new Chronos('2023-04-14');
87
+ * chronos.getBanglaYear(); // Returns: '১৪৩০'
88
+ * chronos.getBanglaYear('en'); // Returns: 1430
89
+ *
90
+ * @remarks
91
+ * - The Bangla year starts on April 14th in the Gregorian calendar.
92
+ * - Year 0 corresponds to 593 CE in the Gregorian calendar.
93
+ */
94
+ getBanglaYear<Locale extends $BnEn = 'bn'>(locale?: Locale): $BanglaYear<Locale>;
95
+ /**
96
+ * @instance Gets the Bangla calendar month for the current date.
97
+ *
98
+ * @param options - Configuration options including locale and calendar variant
99
+ * @returns Bangla month in the specified locale format (1-12)
100
+ *
101
+ * @example
102
+ * const chronos = new Chronos('2023-04-14');
103
+ * chronos.getBanglaMonth(); // Returns: '১' (বৈশাখ)
104
+ * chronos.getBanglaMonth({ locale: 'en' }); // Returns: 1
105
+ * chronos.getBanglaMonth({ variant: 'revised-1966' }); // Returns: '১' with 1966 variant
106
+ *
107
+ * @remarks
108
+ * - Month 1 corresponds to বৈশাখ (mid-April to mid-May).
109
+ * - The result may vary slightly between calendar variants for dates near month boundaries.
110
+ */
111
+ getBanglaMonth<Locale extends $BnEn = 'bn'>(options?: BanglaDateOptions<Locale>): $BanglaMonth<Locale>;
112
+ /**
113
+ * @instance Gets the Bangla calendar day of the month for the current date.
114
+ *
115
+ * @param options - Configuration options including locale and calendar variant
116
+ * @returns Bangla day of month in the specified locale format (1-31)
117
+ *
118
+ * @example
119
+ * const chronos = new Chronos('2023-04-14');
120
+ * chronos.getBanglaDay(); // Returns: '১'
121
+ * chronos.getBanglaDay({ locale: 'en' }); // Returns: 1
122
+ * chronos.getBanglaDay({ variant: 'revised-1966' }); // Returns: '১' with 1966 variant
123
+ *
124
+ * @remarks
125
+ * - The day number is 1-based (১ = first day of the month).
126
+ * - Different calendar variants may have different month lengths for leap years.
127
+ */
128
+ getBanglaDay<Locale extends $BnEn = 'bn'>(options?: BanglaDateOptions<Locale>): $BanglaMonthDate<Locale>;
129
+ /**
130
+ * @instance Gets the Bangla name of the weekday for the current date.
131
+ *
132
+ * @param locale - Output locale ('bn' for Bengali, 'en' for English)
133
+ * @returns Name of the weekday in the specified locale
134
+ *
135
+ * @example
136
+ * const chronos = new Chronos('2023-04-14'); // Friday
137
+ * chronos.getBanglaDayName(); // Returns: 'শুক্রবার'
138
+ * chronos.getBanglaDayName('en'); // Returns: 'Shukrobar (Friday)'
139
+ *
140
+ * @remarks
141
+ * - Weekday names follow the standard Bengali naming convention ending with 'বার'.
142
+ * - English names are the Latin transliterations of the Bangla names with standard English weekday names.
143
+ */
144
+ getBanglaDayName<Locale extends $BnEn = 'bn'>(locale?: Locale): BanglaDayName<Locale>;
145
+ /**
146
+ * @instance Gets the Bangla name of the month for the current date.
147
+ *
148
+ * @param options - Configuration options including locale and calendar variant
149
+ * @returns Name of the month in the specified locale
150
+ *
151
+ * @example
152
+ * const chronos = new Chronos('2023-04-14');
153
+ * chronos.getBanglaMonthName(); // Returns: 'বৈশাখ'
154
+ * chronos.getBanglaMonthName({ locale: 'en' }); // Returns: 'Boishakh'
155
+ * chronos.getBanglaMonthName({ variant: 'revised-1966' }); // Returns: 'বৈশাখ' with 1966 variant
156
+ *
157
+ * @remarks
158
+ * - Month names follow traditional Bengali naming conventions.
159
+ * - English names are transliterated versions of the Bengali names.
160
+ * - Month determination may vary slightly between calendar variants near month boundaries.
161
+ */
162
+ getBanglaMonthName<Locale extends $BnEn = 'bn'>(options?: BanglaDateOptions<Locale>): BanglaMonthName<Locale>;
163
+ /**
164
+ * @instance Gets the Bangla season name for the current date.
165
+ *
166
+ * @param options - Configuration options including locale and calendar variant
167
+ * @returns Name of the season in the specified locale
168
+ *
169
+ * @example
170
+ * const chronos = new Chronos('2023-04-14');
171
+ * chronos.getBanglaSeasonName(); // Returns: 'গ্রীষ্ম'
172
+ * chronos.getBanglaSeasonName({ locale: 'en' }); // Returns: 'Grisma (Summer)'
173
+ *
174
+ * @remarks
175
+ * Bangla calendar is traditionally divided into 6 seasons (ঋতু):
176
+ * - গ্রীষ্ম (Summer): Mid-April to Mid-June
177
+ * - বর্ষা (Monsoon): Mid-June to Mid-August
178
+ * - শরৎ (Autumn): Mid-August to Mid-October
179
+ * - হেমন্ত (Late Autumn): Mid-October to Mid-December
180
+ * - শীত (Winter): Mid-December to Mid-February
181
+ * - বসন্ত (Spring): Mid-February to Mid-April
182
+ */
183
+ getBanglaSeasonName<Locale extends $BnEn = 'bn'>(options?: BanglaDateOptions<Locale>): BanglaSeasonName<Locale>;
184
+ /**
185
+ * @instance Sets the default Bangla calendar variant globally for all `Chronos` instances.
186
+ *
187
+ * @param options Configuration object containing the default Bangla calendar variant.
188
+ *
189
+ * This configuration is applied as the default variant for all Bangla-related methods
190
+ * (like {@link getBanglaMonth}, {@link getBanglaDay}, {@link toBangla}, etc.) across all instances of `Chronos`,
191
+ * unless a specific `variant` is provided in the method options.
192
+ *
193
+ * @remarks
194
+ * - If this method is not called, the default variant is 'revised-2019'.
195
+ * - Calling this method overrides the default globally for **all instances**, both existing and future.
196
+ * - Per-call overrides using the `variant` option will always take precedence over this global default.
197
+ * - Valid variants are `'revised-1966'` and `'revised-2019'`.
198
+ *
199
+ * **Notes**
200
+ * - This method **does not modify the instance**, only sets the default calendar variant.
201
+ *
202
+ * @example
203
+ * const c1 = new Chronos();
204
+ * const c2 = new Chronos();
205
+ *
206
+ * // Before calling the method, all instances use the 2019 variant by default
207
+ * c1.getBanglaMonth(); // uses 'revised-2019'
208
+ * c2.getBanglaMonth(); // uses 'revised-2019'
209
+ *
210
+ * // Set the global default to 1966 variant
211
+ * c1.configureBanglaCalendar({ variant: 'revised-1966' });
212
+ *
213
+ * c1.getBanglaMonth(); // now uses 'revised-1966'
214
+ * c2.getBanglaMonth(); // also uses 'revised-1966'
215
+ *
216
+ * // Per-call override still works
217
+ * c1.getBanglaMonth({ variant: 'revised-2019' }); // uses 'revised-2019' just for this call
218
+ */
219
+ configureBanglaCalendar(options: BnCalendarConfig): void;
220
+ }
221
+ }
222
+ /** * Plugin to inject methods related to Bangla calendar system (`Bongabdo`) */
223
+ declare const banglaPlugin: ($Chronos: $Chronos) => void;
224
+ //#endregion
225
+ export { banglaPlugin };
@@ -0,0 +1,225 @@
1
+ import { $t as BanglaDateOptions, C as $Chronos, Gt as $BanglaYear, Qt as BanglaDateObject, Ut as $BanglaMonth, Wt as $BanglaMonthDate, _n as StrictFormat, an as BnCalendarConfig, en as BanglaDayName, nn as BanglaMonthName, qt as $BnEn, rn as BanglaSeasonName } from "../types-B2fgrJ86.mjs";
2
+
3
+ //#region src/plugins/banglaPlugin.d.ts
4
+ declare module '../' {
5
+ interface Chronos {
6
+ /**
7
+ * @instance Converts the current date to a complete Bangla calendar date object.
8
+ *
9
+ * @param options - Configuration options for the Bangla date output
10
+ * @returns A complete Bangla date object containing year, month, date, names, and leap year status
11
+ *
12
+ * @example
13
+ * Chronos.register(banglaPlugin);
14
+ *
15
+ * const chronos = new Chronos('2023-04-14');
16
+ * const banglaDate = chronos.toBangla();
17
+ * // Returns: {
18
+ * // year: '১৪৩০',
19
+ * // month: '১',
20
+ * // date: '১',
21
+ * // monthName: 'বৈশাখ',
22
+ * // dayName: 'শুক্রবার',
23
+ * // seasonName: 'গ্রীষ্ম',
24
+ * // isLeapYear: false
25
+ * // }
26
+ *
27
+ * const banglaDateEn = chronos.toBangla({ locale: 'en' });
28
+ * // Returns: {
29
+ * // year: 1430,
30
+ * // month: 1,
31
+ * // date: 1,
32
+ * // monthName: 'Boishakh',
33
+ * // dayName: 'Shukrobar (Friday)',
34
+ * // seasonName: 'Grisma (Summer)',
35
+ * // isLeapYear: false
36
+ * // }
37
+ *
38
+ * @remarks
39
+ * - The method uses the default calendar variant unless specified in options.
40
+ * - The locale option determines whether values are returned in Bangla or Latin format.
41
+ */
42
+ toBangla<Locale extends $BnEn = 'bn'>(options?: BanglaDateOptions<Locale>): BanglaDateObject<Locale>;
43
+ /**
44
+ * @instance Formats the current date as a Bangla calendar date string using customizable tokens.
45
+ *
46
+ * @param format - Format string using tokens (default: `'ddd, DD mmmm (SS), YYYY বঙ্গাব্দ - hh:mm:ss (A)'`)
47
+ * @param options - Calendar configuration options
48
+ * @returns Formatted Bangla date string according to the specified format
49
+ *
50
+ * @example
51
+ * const chronos = new Chronos('2023-04-14 14:30:00');
52
+ * chronos.formatBangla();
53
+ * // Returns: 'শুক্রবার, বৈশাখ ০১ (গ্রীষ্মকাল), ১৪৩০ বঙ্গাব্দ - ০২:৩০:০০ (অপরাহ্ণ)'
54
+ *
55
+ * chronos.formatBangla('YYYY-MM-DD');
56
+ * // Returns: '১৪৩০-০১-০১'
57
+ *
58
+ * chronos.formatBangla('mmmm DD, YYYY');
59
+ * // Returns: 'বৈশাখ ০১, ১৪৩০'
60
+ *
61
+ * chronos.formatBangla('hh:mm:ss A');
62
+ * // Returns: '০২:৩০:০০ অপরাহ্ণ'
63
+ *
64
+ * @remarks
65
+ * - 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`, `Z`. `SS`, `S` and.
66
+ * - **Year**: `YYYY/yyyy` (full year), `YY/yy` (last 2 digits)
67
+ * - **Month**: `M/MM`(padded), `mmm` (short name), `mmmm` (full name)
68
+ * - **Day**: `D/DD`(padded), Do (results same as cardinal for Bangla dates)
69
+ * - **Weekday**: `d` (short), `dd` (without 'বার'), `ddd` (full)
70
+ * - **Time**: `H/HH` (24h), `h/hh` (12h), `m/mm` (minute), `s/ss` (second), `ms/mss` (millisecond)
71
+ * - **Period**: `a/A` (am/pm => পূর্বাহ্ণ/অপরাহ্ণ )
72
+ * - **Timezone**: `Z/ZZ` (offset)
73
+ * - **Season**: `S` (season), `SS` (season with 'কাল' suffix)
74
+ * - To output raw text (i.e., not interpreted as a date token), wrap it in square brackets.
75
+ * - For example, `[আজ] ddd` results in `আজ রবিবার`, and `[year ]YYYY` results in `year ২০২৫`.
76
+ * - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
77
+ */
78
+ formatBangla(format?: StrictFormat, options?: BnCalendarConfig): string;
79
+ /**
80
+ * @instance Gets the Bangla calendar year for the current date.
81
+ *
82
+ * @param locale - Output locale ('bn' for Bangla digits, 'en' for Latin digits)
83
+ * @returns Bangla year in the specified locale format
84
+ *
85
+ * @example
86
+ * const chronos = new Chronos('2023-04-14');
87
+ * chronos.getBanglaYear(); // Returns: '১৪৩০'
88
+ * chronos.getBanglaYear('en'); // Returns: 1430
89
+ *
90
+ * @remarks
91
+ * - The Bangla year starts on April 14th in the Gregorian calendar.
92
+ * - Year 0 corresponds to 593 CE in the Gregorian calendar.
93
+ */
94
+ getBanglaYear<Locale extends $BnEn = 'bn'>(locale?: Locale): $BanglaYear<Locale>;
95
+ /**
96
+ * @instance Gets the Bangla calendar month for the current date.
97
+ *
98
+ * @param options - Configuration options including locale and calendar variant
99
+ * @returns Bangla month in the specified locale format (1-12)
100
+ *
101
+ * @example
102
+ * const chronos = new Chronos('2023-04-14');
103
+ * chronos.getBanglaMonth(); // Returns: '১' (বৈশাখ)
104
+ * chronos.getBanglaMonth({ locale: 'en' }); // Returns: 1
105
+ * chronos.getBanglaMonth({ variant: 'revised-1966' }); // Returns: '১' with 1966 variant
106
+ *
107
+ * @remarks
108
+ * - Month 1 corresponds to বৈশাখ (mid-April to mid-May).
109
+ * - The result may vary slightly between calendar variants for dates near month boundaries.
110
+ */
111
+ getBanglaMonth<Locale extends $BnEn = 'bn'>(options?: BanglaDateOptions<Locale>): $BanglaMonth<Locale>;
112
+ /**
113
+ * @instance Gets the Bangla calendar day of the month for the current date.
114
+ *
115
+ * @param options - Configuration options including locale and calendar variant
116
+ * @returns Bangla day of month in the specified locale format (1-31)
117
+ *
118
+ * @example
119
+ * const chronos = new Chronos('2023-04-14');
120
+ * chronos.getBanglaDay(); // Returns: '১'
121
+ * chronos.getBanglaDay({ locale: 'en' }); // Returns: 1
122
+ * chronos.getBanglaDay({ variant: 'revised-1966' }); // Returns: '১' with 1966 variant
123
+ *
124
+ * @remarks
125
+ * - The day number is 1-based (১ = first day of the month).
126
+ * - Different calendar variants may have different month lengths for leap years.
127
+ */
128
+ getBanglaDay<Locale extends $BnEn = 'bn'>(options?: BanglaDateOptions<Locale>): $BanglaMonthDate<Locale>;
129
+ /**
130
+ * @instance Gets the Bangla name of the weekday for the current date.
131
+ *
132
+ * @param locale - Output locale ('bn' for Bengali, 'en' for English)
133
+ * @returns Name of the weekday in the specified locale
134
+ *
135
+ * @example
136
+ * const chronos = new Chronos('2023-04-14'); // Friday
137
+ * chronos.getBanglaDayName(); // Returns: 'শুক্রবার'
138
+ * chronos.getBanglaDayName('en'); // Returns: 'Shukrobar (Friday)'
139
+ *
140
+ * @remarks
141
+ * - Weekday names follow the standard Bengali naming convention ending with 'বার'.
142
+ * - English names are the Latin transliterations of the Bangla names with standard English weekday names.
143
+ */
144
+ getBanglaDayName<Locale extends $BnEn = 'bn'>(locale?: Locale): BanglaDayName<Locale>;
145
+ /**
146
+ * @instance Gets the Bangla name of the month for the current date.
147
+ *
148
+ * @param options - Configuration options including locale and calendar variant
149
+ * @returns Name of the month in the specified locale
150
+ *
151
+ * @example
152
+ * const chronos = new Chronos('2023-04-14');
153
+ * chronos.getBanglaMonthName(); // Returns: 'বৈশাখ'
154
+ * chronos.getBanglaMonthName({ locale: 'en' }); // Returns: 'Boishakh'
155
+ * chronos.getBanglaMonthName({ variant: 'revised-1966' }); // Returns: 'বৈশাখ' with 1966 variant
156
+ *
157
+ * @remarks
158
+ * - Month names follow traditional Bengali naming conventions.
159
+ * - English names are transliterated versions of the Bengali names.
160
+ * - Month determination may vary slightly between calendar variants near month boundaries.
161
+ */
162
+ getBanglaMonthName<Locale extends $BnEn = 'bn'>(options?: BanglaDateOptions<Locale>): BanglaMonthName<Locale>;
163
+ /**
164
+ * @instance Gets the Bangla season name for the current date.
165
+ *
166
+ * @param options - Configuration options including locale and calendar variant
167
+ * @returns Name of the season in the specified locale
168
+ *
169
+ * @example
170
+ * const chronos = new Chronos('2023-04-14');
171
+ * chronos.getBanglaSeasonName(); // Returns: 'গ্রীষ্ম'
172
+ * chronos.getBanglaSeasonName({ locale: 'en' }); // Returns: 'Grisma (Summer)'
173
+ *
174
+ * @remarks
175
+ * Bangla calendar is traditionally divided into 6 seasons (ঋতু):
176
+ * - গ্রীষ্ম (Summer): Mid-April to Mid-June
177
+ * - বর্ষা (Monsoon): Mid-June to Mid-August
178
+ * - শরৎ (Autumn): Mid-August to Mid-October
179
+ * - হেমন্ত (Late Autumn): Mid-October to Mid-December
180
+ * - শীত (Winter): Mid-December to Mid-February
181
+ * - বসন্ত (Spring): Mid-February to Mid-April
182
+ */
183
+ getBanglaSeasonName<Locale extends $BnEn = 'bn'>(options?: BanglaDateOptions<Locale>): BanglaSeasonName<Locale>;
184
+ /**
185
+ * @instance Sets the default Bangla calendar variant globally for all `Chronos` instances.
186
+ *
187
+ * @param options Configuration object containing the default Bangla calendar variant.
188
+ *
189
+ * This configuration is applied as the default variant for all Bangla-related methods
190
+ * (like {@link getBanglaMonth}, {@link getBanglaDay}, {@link toBangla}, etc.) across all instances of `Chronos`,
191
+ * unless a specific `variant` is provided in the method options.
192
+ *
193
+ * @remarks
194
+ * - If this method is not called, the default variant is 'revised-2019'.
195
+ * - Calling this method overrides the default globally for **all instances**, both existing and future.
196
+ * - Per-call overrides using the `variant` option will always take precedence over this global default.
197
+ * - Valid variants are `'revised-1966'` and `'revised-2019'`.
198
+ *
199
+ * **Notes**
200
+ * - This method **does not modify the instance**, only sets the default calendar variant.
201
+ *
202
+ * @example
203
+ * const c1 = new Chronos();
204
+ * const c2 = new Chronos();
205
+ *
206
+ * // Before calling the method, all instances use the 2019 variant by default
207
+ * c1.getBanglaMonth(); // uses 'revised-2019'
208
+ * c2.getBanglaMonth(); // uses 'revised-2019'
209
+ *
210
+ * // Set the global default to 1966 variant
211
+ * c1.configureBanglaCalendar({ variant: 'revised-1966' });
212
+ *
213
+ * c1.getBanglaMonth(); // now uses 'revised-1966'
214
+ * c2.getBanglaMonth(); // also uses 'revised-1966'
215
+ *
216
+ * // Per-call override still works
217
+ * c1.getBanglaMonth({ variant: 'revised-2019' }); // uses 'revised-2019' just for this call
218
+ */
219
+ configureBanglaCalendar(options: BnCalendarConfig): void;
220
+ }
221
+ }
222
+ /** * Plugin to inject methods related to Bangla calendar system (`Bongabdo`) */
223
+ declare const banglaPlugin: ($Chronos: $Chronos) => void;
224
+ //#endregion
225
+ export { banglaPlugin };
@@ -0,0 +1 @@
1
+ import{n as e,s as t,t as n}from"../basic-e46DaNAi.mjs";import{n as r,r as i}from"../primitives-Cxss_JVF.mjs";import{a,i as o}from"../utilities-BJE06bms.mjs";import{a as s,d as c,i as l,l as u,o as d,t as f}from"../helpers-N1X_Rj_V.mjs";function p(e,t=!0){let n=Object.keys(o),s=e=>e.replace(/\d/g,e=>n[Number(e)]);if(i(e))return s(String(e));if(r(e)){let r=s(e);return t||a(e)?r:r.split(``).filter(e=>n.includes(e)).join(``)}return``}const m=r=>{let{internalDate:i}=r[t],a=new Map;function o(e,t){return f(e,t??a.get(`config`)?.variant)}r.prototype.configureBanglaCalendar=function(e){a.set(`config`,e)},r.prototype.getBanglaYear=function(e=`bn`){let t=d(i(this));return e===`en`?t:p(t)},r.prototype.getBanglaMonth=function(e){let{locale:t=`bn`,variant:n}=e??{},r=o(i(this),n).monthIdx+1;return t===`en`?r:p(r)},r.prototype.getBanglaDay=function(e){let{locale:t=`bn`,variant:n}=e??{},r=o(i(this),n).days+1;return t===`en`?r:p(r)},r.prototype.getBanglaDayName=function(e=`bn`){let t=n[this.weekDay];return e===`en`?t.en:t.bn},r.prototype.getBanglaMonthName=function(t){let{locale:n=`bn`,variant:r}=t??{},{monthIdx:a}=o(i(this),r),s=e[a];return n===`en`?s.en:s.bn},r.prototype.getBanglaSeasonName=function(e){let{locale:t,variant:n}=e??{},{monthIdx:r}=o(i(this),n);return s(r,t)},r.prototype.toBangla=function(e){return{year:this.getBanglaYear(e?.locale),month:this.getBanglaMonth(e),date:this.getBanglaDay(e),monthName:this.getBanglaMonthName(e),dayName:this.getBanglaDayName(e?.locale),seasonName:this.getBanglaSeasonName(e),isLeapYear:u(d(i(this)),this.year,e?.variant)}},r.prototype.formatBangla=function(t,r){let{hour:a,minute:s,second:u,millisecond:d}=this,f=n[this.weekDay],{monthIdx:m}=o(i(this),r?.variant),h=e[m],g=this.getBanglaMonth(),_=c(this.getBanglaYear(),4),v=this.getBanglaDay(),y=this.getBanglaSeasonName(),b=p(this.getTimeZoneOffset()),x={YYYY:_,YY:_.slice(-2),yyyy:_,yy:_.slice(-2),M:g,MM:c(g),mmm:h.short,mmmm:h.bn,d:f.short,dd:f.bn.replace(`বার`,``),ddd:f.bn,D:v,DD:c(v),Do:v,H:p(a),HH:c(p(a)),h:p(a%12||12),hh:c(p(a%12||12)),m:p(s),mm:c(p(s)),s:p(u),ss:c(p(u)),ms:p(d),mss:c(p(d),3),a:a<12?`পূর্বাহ্ণ`:`অপরাহ্ণ`,A:a<12?`পূর্বাহ্ণ`:`অপরাহ্ণ`,Z:b,ZZ:b,S:y,SS:y+`কাল`};return l(t||`ddd, DD mmmm (SS), YYYY বঙ্গাব্দ - hh:mm:ss (A)`,x)}};export{m as banglaPlugin};
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../basic-CKxaRSHQ.cjs`),t=require(`../primitives-Db2FUp4e.cjs`),n=require(`../non-primitives-Bu3a4WL4.cjs`),r=r=>{let{internalDate:i,withOrigin:a,cast:o,offset:s}=r[e.s],c=(e,t)=>{let r=n.a(e)?[...e].sort():Array.from({length:t},(t,n)=>(e+7-1-n)%7).sort(),i=Array(7).fill(!0);for(let e of r)i[e]=!1;return i},l=(e,t,n,r=1,i=!0)=>{let a=Math.floor(t/7)*n.filter(e=>i?!!e:!e).length,o=(e%7+7)%7;for(let e=0;e<t%7;e++)(i?n[o]:!n[o])&&a++,o=(o+r+7)%7;return a};r.prototype.isWeekend=function(e=0,t=2){let r=i(this).getDay();if(n.a(e))return e.includes(r);let a=(e+6)%7;return Array.from({length:t},(e,t)=>(a-t+7)%7).includes(r)},r.prototype.isWorkday=function(e=0,t=2){return!this.isWeekend(e,t)},r.prototype.nextWorkday=function(e=0,t=2){let n=this.addDays(1);for(;n.isWeekend(e,t);)n=n.addDays(1);return a(n.startOf(`day`),`nextWorkday`,s(this),this.timeZoneName,this.timeZoneId,this.$tzTracker)},r.prototype.previousWorkday=function(e=0,t=2){let n=this.addDays(-1);for(;n.isWeekend(e,t);)n=n.addDays(-1);return a(n.startOf(`day`),`previousWorkday`,s(this),this.timeZoneName,this.timeZoneId,this.$tzTracker)},r.prototype.nextWeekend=function(e=0,t=2){let n=this.addDays(1);for(;!n.isWeekend(e,t);)n=n.addDays(1);return a(n.startOf(`day`),`nextWeekend`,s(this),this.timeZoneName,this.timeZoneId,this.$tzTracker)},r.prototype.previousWeekend=function(e=0,t=2){let n=this.addDays(-1);for(;!n.isWeekend(e,t);)n=n.addDays(-1);return a(n.startOf(`day`),`previousWeekend`,s(this),this.timeZoneName,this.timeZoneId,this.$tzTracker)},r.prototype.workdaysBetween=function(e,t=0,n=2){let r=o(e).startOf(`day`),i=this.startOf(`day`);if(i.isSame(r,`day`))return 0;let a=i.isBefore(r,`day`)?1:-1,s=Math.abs(r.diff(i,`day`)),u=c(t,n);return l((i.isoWeekDay+a)%7,s,u,a)},r.prototype.weekendsBetween=function(e,t=0,n=2){let r=o(e).startOf(`day`),i=this.startOf(`day`);if(i.isSame(r,`day`))return 0;let a=i.isBefore(r,`day`)?1:-1,s=Math.abs(r.diff(i,`day`)),u=c(t,n);return l((i.isoWeekDay+a)%7,s,u,a,!1)},r.prototype.workdaysInMonth=function(e=0,t=2){let n=this.daysInMonth(),r=c(e,t);return l(this.startOf(`month`).isoWeekDay%7,n,r)},r.prototype.weekendsInMonth=function(e=0,t=2){let n=this.daysInMonth(),r=c(e,t);return l(this.startOf(`month`).isoWeekDay%7,n,r,1,!1)},r.prototype.workdaysInYear=function(e=0,t=2){let n=this.isLeapYear()?366:365,r=c(e,t);return l(this.startOf(`year`).isoWeekDay%7,n,r)},r.prototype.weekendsInYear=function(e=0,t=2){let n=this.isLeapYear()?366:365,r=c(e,t);return l(this.startOf(`year`).isoWeekDay%7,n,r,1,!1)},r.prototype.isBusinessHour=function(e){let n=()=>{let{businessStartHour:t=9,businessEndHour:n=17}=e??{};if(t===n)return!1;let r=i(this).getHours();return t<n?r>=t&&r<n:r>=t||r<n};if(e&&`weekendDays`in e&&!t.a(e?.weekendDays))return this.isWorkday(e.weekendDays)&&n();let{weekStartsOn:r=0,weekendLength:a=2}=e??{};return this.isWorkday(r,a)&&n()},r.prototype.toFiscalQuarter=function(e=7){let t=(this.isoMonth-e+12)%12;return Math.floor(t/3)+1},r.prototype.toAcademicYear=function(){let e=this.year;return this.month>=6?`${e}-${e+1}`:`${e-1}-${e}`}};exports.businessPlugin=r;