chronos-date 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{basic-Dputob9z.mjs → basic-DqKyujoj.mjs} +16 -0
- package/dist/{basic-DIp_pxR2.cjs → basic-DsQqC5nZ.cjs} +16 -0
- package/dist/constants.cjs +19 -3
- package/dist/constants.d.cts +17 -1
- package/dist/constants.d.mts +17 -1
- package/dist/constants.mjs +19 -3
- package/dist/{convert-dQuGWhVm.cjs → convert-DbgntRVW.cjs} +17 -1
- package/dist/{convert-CNVL-mop.mjs → convert-mMaI4YP0.mjs} +17 -1
- package/dist/{greet-B9j4afzD.mjs → greet-D07t2_e6.mjs} +17 -1
- package/dist/{greet-B8ZtypgG.cjs → greet-hjVsd2dt.cjs} +17 -1
- package/dist/guards.cjs +32 -11
- package/dist/guards.d.cts +18 -2
- package/dist/guards.d.mts +18 -2
- package/dist/guards.mjs +32 -11
- package/dist/{helpers-M_SfAbAv.cjs → helpers-CQzi908i.cjs} +20 -4
- package/dist/{helpers-CrMc9iJZ.mjs → helpers-DEf4sevD.mjs} +20 -4
- package/dist/index.cjs +42 -26
- package/dist/index.d.cts +18 -2
- package/dist/index.d.mts +18 -2
- package/dist/index.mjs +43 -27
- package/dist/{non-primitives-CT4vszrX.cjs → non-primitives-D9zxCwX8.cjs} +16 -0
- package/dist/{non-primitives-DrQfPj1r.mjs → non-primitives-DBtomDty.mjs} +16 -0
- package/dist/plugins/banglaPlugin.cjs +21 -5
- package/dist/plugins/banglaPlugin.d.cts +19 -3
- package/dist/plugins/banglaPlugin.d.mts +19 -3
- package/dist/plugins/banglaPlugin.mjs +21 -5
- package/dist/plugins/businessPlugin.cjs +19 -3
- package/dist/plugins/businessPlugin.d.cts +17 -1
- package/dist/plugins/businessPlugin.d.mts +17 -1
- package/dist/plugins/businessPlugin.mjs +19 -3
- package/dist/plugins/dateRangePlugin.cjs +19 -3
- package/dist/plugins/dateRangePlugin.d.cts +21 -5
- package/dist/plugins/dateRangePlugin.d.mts +21 -5
- package/dist/plugins/dateRangePlugin.mjs +19 -3
- package/dist/plugins/dayPartPlugin.cjs +18 -2
- package/dist/plugins/dayPartPlugin.d.cts +17 -1
- package/dist/plugins/dayPartPlugin.d.mts +17 -1
- package/dist/plugins/dayPartPlugin.mjs +18 -2
- package/dist/plugins/durationPlugin.cjs +17 -1
- package/dist/plugins/durationPlugin.d.cts +17 -1
- package/dist/plugins/durationPlugin.d.mts +17 -1
- package/dist/plugins/durationPlugin.mjs +17 -1
- package/dist/plugins/fromNowPlugin.cjs +18 -2
- package/dist/plugins/fromNowPlugin.d.cts +17 -1
- package/dist/plugins/fromNowPlugin.d.mts +17 -1
- package/dist/plugins/fromNowPlugin.mjs +18 -2
- package/dist/plugins/greetingPlugin.cjs +17 -1
- package/dist/plugins/greetingPlugin.d.cts +18 -2
- package/dist/plugins/greetingPlugin.d.mts +18 -2
- package/dist/plugins/greetingPlugin.mjs +17 -1
- package/dist/plugins/palindromePlugin.cjs +17 -1
- package/dist/plugins/palindromePlugin.d.cts +17 -1
- package/dist/plugins/palindromePlugin.d.mts +17 -1
- package/dist/plugins/palindromePlugin.mjs +17 -1
- package/dist/plugins/relativeTimePlugin.cjs +17 -1
- package/dist/plugins/relativeTimePlugin.d.cts +17 -1
- package/dist/plugins/relativeTimePlugin.d.mts +17 -1
- package/dist/plugins/relativeTimePlugin.mjs +17 -1
- package/dist/plugins/roundPlugin.cjs +19 -3
- package/dist/plugins/roundPlugin.d.cts +17 -1
- package/dist/plugins/roundPlugin.d.mts +17 -1
- package/dist/plugins/roundPlugin.mjs +19 -3
- package/dist/plugins/seasonPlugin.cjs +17 -1
- package/dist/plugins/seasonPlugin.d.cts +18 -2
- package/dist/plugins/seasonPlugin.d.mts +18 -2
- package/dist/plugins/seasonPlugin.mjs +17 -1
- package/dist/plugins/timeZonePlugin.cjs +20 -4
- package/dist/plugins/timeZonePlugin.d.cts +17 -1
- package/dist/plugins/timeZonePlugin.d.mts +17 -1
- package/dist/plugins/timeZonePlugin.mjs +20 -4
- package/dist/plugins/zodiacPlugin.cjs +18 -2
- package/dist/plugins/zodiacPlugin.d.cts +18 -2
- package/dist/plugins/zodiacPlugin.d.mts +18 -2
- package/dist/plugins/zodiacPlugin.mjs +18 -2
- package/dist/{primitives-BME3_QrA.cjs → primitives-CtuSNmV7.cjs} +16 -0
- package/dist/primitives-dXzXlzJw.mjs +35 -0
- package/dist/{seasons-CcZicoe1.cjs → seasons-B7kK88zq.cjs} +16 -0
- package/dist/{seasons-CioTH5Dm.d.mts → seasons-B_kjFWIX.d.mts} +16 -0
- package/dist/{seasons-CsVeJ27s.d.cts → seasons-CpUn45n6.d.cts} +16 -0
- package/dist/{seasons-CHnjrIKK.mjs → seasons-Cq3ah3pV.mjs} +16 -0
- package/dist/{timezone-DYVJJYKz.cjs → timezone-BNnHFgki.cjs} +16 -0
- package/dist/{timezone-BfBXeMK_.mjs → timezone-Db2CeL32.mjs} +16 -0
- package/dist/{types-B2fgrJ86.d.mts → types-Bs_rfkka.d.mts} +46 -32
- package/dist/{types-DPTQ_yLx.d.cts → types-CaVuY1_4.d.cts} +46 -32
- package/dist/types.cjs +16 -0
- package/dist/types.d.cts +18 -2
- package/dist/types.d.mts +18 -2
- package/dist/types.mjs +16 -0
- package/dist/{utilities-CtOZhIYv.mjs → utilities-BGX8dviZ.mjs} +21 -5
- package/dist/{utilities-BU4MSYS7.mjs → utilities-BKtVo78T.mjs} +17 -1
- package/dist/{utilities-CGL7F6R9.cjs → utilities-CpF3uys3.cjs} +17 -1
- package/dist/{utilities-bXwTPJaD.cjs → utilities-D47SN9EZ.cjs} +21 -5
- package/dist/utils.cjs +21 -5
- package/dist/utils.d.cts +20 -4
- package/dist/utils.d.mts +20 -4
- package/dist/utils.mjs +21 -5
- package/package.json +10 -4
- package/dist/primitives-DEt6I7Sy.mjs +0 -19
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_basic = require('./basic-
|
|
3
|
-
const require_primitives = require('./primitives-
|
|
4
|
-
const require_non_primitives = require('./non-primitives-
|
|
18
|
+
const require_basic = require('./basic-DsQqC5nZ.cjs');
|
|
19
|
+
const require_primitives = require('./primitives-CtuSNmV7.cjs');
|
|
20
|
+
const require_non_primitives = require('./non-primitives-D9zxCwX8.cjs');
|
|
5
21
|
const require_guards = require('./guards.cjs');
|
|
6
|
-
const require_helpers = require('./helpers-
|
|
7
|
-
const require_utilities = require('./utilities-
|
|
22
|
+
const require_helpers = require('./helpers-CQzi908i.cjs');
|
|
23
|
+
const require_utilities = require('./utilities-D47SN9EZ.cjs');
|
|
8
24
|
|
|
9
25
|
//#region src/utils/chronos-fn.ts
|
|
10
26
|
/**
|
|
@@ -200,24 +216,24 @@ var Chronos = class Chronos {
|
|
|
200
216
|
* 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.
|
|
201
217
|
*
|
|
202
218
|
* @remarks
|
|
203
|
-
* - Invoking the {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
219
|
+
* - 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}.
|
|
204
220
|
* - To retrieve the local system's native timezone name (or its identifier if the name is unavailable), use the {@link $getNativeTimeZoneName} instance method.
|
|
205
221
|
*/
|
|
206
222
|
timeZoneName;
|
|
207
223
|
/**
|
|
208
224
|
* Represents the current timezone context, which can be a single identifier, an array of equivalent identifiers, or a UTC offset.
|
|
209
225
|
*
|
|
210
|
-
* - **{@link $TimeZoneIdentifier}** — e.g., `"Asia/Dhaka"`. Returned when the {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
226
|
+
* - **{@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.
|
|
211
227
|
* - **Array of {@link $TimeZoneIdentifier}** — e.g., `[ 'Asia/Calcutta', 'Asia/Colombo' ]`, used when multiple timezones share the same UTC offset such as `"UTC+05:30"`.
|
|
212
228
|
* - **{@link UTCOffset}** — e.g., `"UTC+06:45"` or `"UTC+02:15"`, returned when no named timezone corresponds to a given offset.
|
|
213
229
|
*
|
|
214
230
|
* @remarks
|
|
215
|
-
* - By default, when {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
231
|
+
* - 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.
|
|
216
232
|
* - When applied, it may instead return a single identifier string, an array of equivalent identifiers or a UTC offset string.
|
|
217
233
|
* - To retrieve the local system's native timezone identifier, use the {@link $getNativeTimeZoneId} instance method.
|
|
218
234
|
*/
|
|
219
235
|
timeZoneId;
|
|
220
|
-
/** Tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
236
|
+
/** Tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/conversion#timezone timeZone} method */
|
|
221
237
|
$tzTracker;
|
|
222
238
|
/**
|
|
223
239
|
* * Creates a new immutable `Chronos` instance.
|
|
@@ -294,7 +310,7 @@ var Chronos = class Chronos {
|
|
|
294
310
|
*
|
|
295
311
|
* @remarks
|
|
296
312
|
* - This method always reflects the local machine's time zone if `tzId` is parameter is omitted.
|
|
297
|
-
* - {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
313
|
+
* - {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/conversion#timezone timeZone}, {@link utc}, or {@link toUTC} methods have no effects on this method.
|
|
298
314
|
* - To access the time zone name of a modified or converted instance, use the {@link timeZoneName} public property instead.
|
|
299
315
|
*
|
|
300
316
|
* @param tzId Optional time zone identifier to get time zone name for that specific identifier if available.
|
|
@@ -310,7 +326,7 @@ var Chronos = class Chronos {
|
|
|
310
326
|
*
|
|
311
327
|
* @remarks
|
|
312
328
|
* - This method always returns the identifier of the local machine's time zone.
|
|
313
|
-
* - {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
329
|
+
* - {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/conversion#timezone timeZone}, {@link utc}, or {@link toUTC} methods have no effects on this method.
|
|
314
330
|
* - To obtain the identifier(s) of a modified or converted instance, use the {@link timeZoneId} public property instead.
|
|
315
331
|
*
|
|
316
332
|
* @returns The local system's IANA time zone identifier.
|
|
@@ -339,7 +355,7 @@ var Chronos = class Chronos {
|
|
|
339
355
|
* @param offset Optional UTC offset in `UTC±HH:mm` format.
|
|
340
356
|
* @param tzName Optional time zone name to set.
|
|
341
357
|
* @param tzId Optional time zone identifier(s) to set.
|
|
342
|
-
* @param tzTracker Optional tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
358
|
+
* @param tzTracker Optional tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/conversion#timezone timeZone} method.
|
|
343
359
|
* @returns The `Chronos` instance with the specified origin and other properties.
|
|
344
360
|
*/
|
|
345
361
|
#withOrigin(origin, offset, tzName, tzId, tzTracker) {
|
|
@@ -500,7 +516,7 @@ var Chronos = class Chronos {
|
|
|
500
516
|
*
|
|
501
517
|
* - 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`.
|
|
502
518
|
* - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
|
|
503
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
519
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/format#format-tokens format tokens} for details.
|
|
504
520
|
*
|
|
505
521
|
* @param useUTC - Optional boolean to format the date using UTC time.
|
|
506
522
|
* When `true`, it behaves like `formatUTC()` and outputs time based on UTC offset. Defaults to `false`.
|
|
@@ -518,7 +534,7 @@ var Chronos = class Chronos {
|
|
|
518
534
|
*
|
|
519
535
|
* @param format - The desired format string. Defaults to `'dd, mmm DD, YYYY HH:mm:ss'`
|
|
520
536
|
* (e.g., `'Sun, Apr 06, 2025 16:11:55'`).
|
|
521
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
537
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/format#format-tokens format tokens} for details.
|
|
522
538
|
*
|
|
523
539
|
* @param useUTC - If `true`, formats the date in UTC (equivalent to `formatUTC()`).
|
|
524
540
|
* Defaults to `false` (local time).
|
|
@@ -537,7 +553,7 @@ var Chronos = class Chronos {
|
|
|
537
553
|
*
|
|
538
554
|
* - 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`.
|
|
539
555
|
* - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
|
|
540
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
556
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/format#format-tokens format tokens} for details.
|
|
541
557
|
*
|
|
542
558
|
* @returns Formatted date string in desired format (UTC time).
|
|
543
559
|
*/
|
|
@@ -1219,8 +1235,8 @@ var Chronos = class Chronos {
|
|
|
1219
1235
|
}
|
|
1220
1236
|
/**
|
|
1221
1237
|
* @static Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
|
|
1222
|
-
* * It basically calls {@link Date.now()}.
|
|
1223
1238
|
* @returns The number of milliseconds elapsed since the Unix epoch.
|
|
1239
|
+
* @remarks It internally uses {@link Date.now()}.
|
|
1224
1240
|
*/
|
|
1225
1241
|
static now() {
|
|
1226
1242
|
return Date.now();
|
|
@@ -1270,7 +1286,7 @@ var Chronos = class Chronos {
|
|
|
1270
1286
|
* @param options - Relative range (e.g., 7 days, 4 weeks) or date range (from/to) and output format.
|
|
1271
1287
|
* @returns Array of ISO date strings in the specified format.
|
|
1272
1288
|
*
|
|
1273
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
1289
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/statics#getdatesforday docs} for details.
|
|
1274
1290
|
*/
|
|
1275
1291
|
static getDatesForDay(day, options) {
|
|
1276
1292
|
let startDate = new Chronos(), endDate = startDate.addWeeks(4);
|
|
@@ -1345,12 +1361,12 @@ var Chronos = class Chronos {
|
|
|
1345
1361
|
* - A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400.
|
|
1346
1362
|
* - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not.
|
|
1347
1363
|
*
|
|
1348
|
-
* @
|
|
1349
|
-
* This method accepts different types of date inputs and extracts the year to check if it's a leap year.
|
|
1350
|
-
* If the provided date is a `number`, it will be treated as a year (must be a valid year from 0 to 9999).
|
|
1351
|
-
* If the year is out of this range (negative or larger than 9999), it will be treated as a Unix timestamp.
|
|
1352
|
-
* If the provided date is a string or a `Date` object, it will be parsed and the year will be extracted.
|
|
1353
|
-
* If a `Chronos` instance is passed, the year will be directly accessed from the instance.
|
|
1364
|
+
* @remarks
|
|
1365
|
+
* - This method accepts different types of date inputs and extracts the year to check if it's a leap year.
|
|
1366
|
+
* - If the provided date is a `number`, it will be treated as a year (must be a valid year from 0 to 9999).
|
|
1367
|
+
* - If the year is out of this range (negative or larger than 9999), it will be treated as a Unix timestamp.
|
|
1368
|
+
* - If the provided date is a string or a `Date` object, it will be parsed and the year will be extracted.
|
|
1369
|
+
* - If a `Chronos` instance is passed, the year will be directly accessed from the instance.
|
|
1354
1370
|
*
|
|
1355
1371
|
* @param date - A `number` (year or Unix timestamp), `string`, `Date`, or `Chronos` instance representing a date.
|
|
1356
1372
|
* @returns `true` if the year is a leap year, `false` otherwise.
|
|
@@ -1380,7 +1396,7 @@ var Chronos = class Chronos {
|
|
|
1380
1396
|
* @returns `true` if the value is a valid date string, otherwise `false`.
|
|
1381
1397
|
*/
|
|
1382
1398
|
static isDateString(value) {
|
|
1383
|
-
return
|
|
1399
|
+
return require_guards.isDateString(value);
|
|
1384
1400
|
}
|
|
1385
1401
|
/**
|
|
1386
1402
|
* @static Checks if the given value is an instance of `Chronos`.
|
|
@@ -1426,7 +1442,7 @@ var Chronos = class Chronos {
|
|
|
1426
1442
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using {@link register} method (alias `use` method).
|
|
1427
1443
|
*
|
|
1428
1444
|
* - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
|
|
1429
|
-
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
1445
|
+
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1430
1446
|
*/
|
|
1431
1447
|
static use(plugin) {
|
|
1432
1448
|
if (!Chronos.#plugins.has(plugin)) {
|
|
@@ -1444,7 +1460,7 @@ var Chronos = class Chronos {
|
|
|
1444
1460
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using this (`register`) method over {@link use} method.
|
|
1445
1461
|
*
|
|
1446
1462
|
* - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
|
|
1447
|
-
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
1463
|
+
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1448
1464
|
*/
|
|
1449
1465
|
static register(plugin) {
|
|
1450
1466
|
Chronos.use(plugin);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { D as INTERNALS } from "./seasons-CpUn45n6.cjs";
|
|
18
|
+
import { Bt as Chronos, Vt as chronos } from "./types-CaVuY1_4.cjs";
|
|
3
19
|
export { Chronos, INTERNALS, chronos };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { D as INTERNALS } from "./seasons-B_kjFWIX.mjs";
|
|
18
|
+
import { Bt as Chronos, Vt as chronos } from "./types-Bs_rfkka.mjs";
|
|
3
19
|
export { Chronos, INTERNALS, chronos };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { c as MONTHS, o as DAYS, s as INTERNALS, u as MS_PER_DAY } from "./basic-DqKyujoj.mjs";
|
|
18
|
+
import { r as isNumber } from "./primitives-dXzXlzJw.mjs";
|
|
19
|
+
import { t as isFunction } from "./non-primitives-DBtomDty.mjs";
|
|
20
|
+
import { isDateString, isLeapYear } from "./guards.mjs";
|
|
21
|
+
import { c as _hasChronosProperties, n as _dateArgsToDate, p as _resolveNativeTzName, r as _formatDate, u as _normalizeOffset } from "./helpers-DEf4sevD.mjs";
|
|
22
|
+
import { l as getNativeTimeZoneId, r as extractMinutesFromUTC } from "./utilities-BGX8dviZ.mjs";
|
|
7
23
|
|
|
8
24
|
//#region src/utils/chronos-fn.ts
|
|
9
25
|
/**
|
|
@@ -199,24 +215,24 @@ var Chronos = class Chronos {
|
|
|
199
215
|
* 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.
|
|
200
216
|
*
|
|
201
217
|
* @remarks
|
|
202
|
-
* - Invoking the {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
218
|
+
* - 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}.
|
|
203
219
|
* - To retrieve the local system's native timezone name (or its identifier if the name is unavailable), use the {@link $getNativeTimeZoneName} instance method.
|
|
204
220
|
*/
|
|
205
221
|
timeZoneName;
|
|
206
222
|
/**
|
|
207
223
|
* Represents the current timezone context, which can be a single identifier, an array of equivalent identifiers, or a UTC offset.
|
|
208
224
|
*
|
|
209
|
-
* - **{@link $TimeZoneIdentifier}** — e.g., `"Asia/Dhaka"`. Returned when the {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
225
|
+
* - **{@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.
|
|
210
226
|
* - **Array of {@link $TimeZoneIdentifier}** — e.g., `[ 'Asia/Calcutta', 'Asia/Colombo' ]`, used when multiple timezones share the same UTC offset such as `"UTC+05:30"`.
|
|
211
227
|
* - **{@link UTCOffset}** — e.g., `"UTC+06:45"` or `"UTC+02:15"`, returned when no named timezone corresponds to a given offset.
|
|
212
228
|
*
|
|
213
229
|
* @remarks
|
|
214
|
-
* - By default, when {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
230
|
+
* - 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.
|
|
215
231
|
* - When applied, it may instead return a single identifier string, an array of equivalent identifiers or a UTC offset string.
|
|
216
232
|
* - To retrieve the local system's native timezone identifier, use the {@link $getNativeTimeZoneId} instance method.
|
|
217
233
|
*/
|
|
218
234
|
timeZoneId;
|
|
219
|
-
/** Tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
235
|
+
/** Tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/conversion#timezone timeZone} method */
|
|
220
236
|
$tzTracker;
|
|
221
237
|
/**
|
|
222
238
|
* * Creates a new immutable `Chronos` instance.
|
|
@@ -293,7 +309,7 @@ var Chronos = class Chronos {
|
|
|
293
309
|
*
|
|
294
310
|
* @remarks
|
|
295
311
|
* - This method always reflects the local machine's time zone if `tzId` is parameter is omitted.
|
|
296
|
-
* - {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
312
|
+
* - {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/conversion#timezone timeZone}, {@link utc}, or {@link toUTC} methods have no effects on this method.
|
|
297
313
|
* - To access the time zone name of a modified or converted instance, use the {@link timeZoneName} public property instead.
|
|
298
314
|
*
|
|
299
315
|
* @param tzId Optional time zone identifier to get time zone name for that specific identifier if available.
|
|
@@ -309,7 +325,7 @@ var Chronos = class Chronos {
|
|
|
309
325
|
*
|
|
310
326
|
* @remarks
|
|
311
327
|
* - This method always returns the identifier of the local machine's time zone.
|
|
312
|
-
* - {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
328
|
+
* - {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/conversion#timezone timeZone}, {@link utc}, or {@link toUTC} methods have no effects on this method.
|
|
313
329
|
* - To obtain the identifier(s) of a modified or converted instance, use the {@link timeZoneId} public property instead.
|
|
314
330
|
*
|
|
315
331
|
* @returns The local system's IANA time zone identifier.
|
|
@@ -338,7 +354,7 @@ var Chronos = class Chronos {
|
|
|
338
354
|
* @param offset Optional UTC offset in `UTC±HH:mm` format.
|
|
339
355
|
* @param tzName Optional time zone name to set.
|
|
340
356
|
* @param tzId Optional time zone identifier(s) to set.
|
|
341
|
-
* @param tzTracker Optional tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
357
|
+
* @param tzTracker Optional tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/conversion#timezone timeZone} method.
|
|
342
358
|
* @returns The `Chronos` instance with the specified origin and other properties.
|
|
343
359
|
*/
|
|
344
360
|
#withOrigin(origin, offset, tzName, tzId, tzTracker) {
|
|
@@ -499,7 +515,7 @@ var Chronos = class Chronos {
|
|
|
499
515
|
*
|
|
500
516
|
* - 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`.
|
|
501
517
|
* - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
|
|
502
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
518
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/format#format-tokens format tokens} for details.
|
|
503
519
|
*
|
|
504
520
|
* @param useUTC - Optional boolean to format the date using UTC time.
|
|
505
521
|
* When `true`, it behaves like `formatUTC()` and outputs time based on UTC offset. Defaults to `false`.
|
|
@@ -517,7 +533,7 @@ var Chronos = class Chronos {
|
|
|
517
533
|
*
|
|
518
534
|
* @param format - The desired format string. Defaults to `'dd, mmm DD, YYYY HH:mm:ss'`
|
|
519
535
|
* (e.g., `'Sun, Apr 06, 2025 16:11:55'`).
|
|
520
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
536
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/format#format-tokens format tokens} for details.
|
|
521
537
|
*
|
|
522
538
|
* @param useUTC - If `true`, formats the date in UTC (equivalent to `formatUTC()`).
|
|
523
539
|
* Defaults to `false` (local time).
|
|
@@ -536,7 +552,7 @@ var Chronos = class Chronos {
|
|
|
536
552
|
*
|
|
537
553
|
* - 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`.
|
|
538
554
|
* - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
|
|
539
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
555
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/format#format-tokens format tokens} for details.
|
|
540
556
|
*
|
|
541
557
|
* @returns Formatted date string in desired format (UTC time).
|
|
542
558
|
*/
|
|
@@ -1218,8 +1234,8 @@ var Chronos = class Chronos {
|
|
|
1218
1234
|
}
|
|
1219
1235
|
/**
|
|
1220
1236
|
* @static Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
|
|
1221
|
-
* * It basically calls {@link Date.now()}.
|
|
1222
1237
|
* @returns The number of milliseconds elapsed since the Unix epoch.
|
|
1238
|
+
* @remarks It internally uses {@link Date.now()}.
|
|
1223
1239
|
*/
|
|
1224
1240
|
static now() {
|
|
1225
1241
|
return Date.now();
|
|
@@ -1269,7 +1285,7 @@ var Chronos = class Chronos {
|
|
|
1269
1285
|
* @param options - Relative range (e.g., 7 days, 4 weeks) or date range (from/to) and output format.
|
|
1270
1286
|
* @returns Array of ISO date strings in the specified format.
|
|
1271
1287
|
*
|
|
1272
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
1288
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/statics#getdatesforday docs} for details.
|
|
1273
1289
|
*/
|
|
1274
1290
|
static getDatesForDay(day, options) {
|
|
1275
1291
|
let startDate = new Chronos(), endDate = startDate.addWeeks(4);
|
|
@@ -1344,12 +1360,12 @@ var Chronos = class Chronos {
|
|
|
1344
1360
|
* - A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400.
|
|
1345
1361
|
* - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not.
|
|
1346
1362
|
*
|
|
1347
|
-
* @
|
|
1348
|
-
* This method accepts different types of date inputs and extracts the year to check if it's a leap year.
|
|
1349
|
-
* If the provided date is a `number`, it will be treated as a year (must be a valid year from 0 to 9999).
|
|
1350
|
-
* If the year is out of this range (negative or larger than 9999), it will be treated as a Unix timestamp.
|
|
1351
|
-
* If the provided date is a string or a `Date` object, it will be parsed and the year will be extracted.
|
|
1352
|
-
* If a `Chronos` instance is passed, the year will be directly accessed from the instance.
|
|
1363
|
+
* @remarks
|
|
1364
|
+
* - This method accepts different types of date inputs and extracts the year to check if it's a leap year.
|
|
1365
|
+
* - If the provided date is a `number`, it will be treated as a year (must be a valid year from 0 to 9999).
|
|
1366
|
+
* - If the year is out of this range (negative or larger than 9999), it will be treated as a Unix timestamp.
|
|
1367
|
+
* - If the provided date is a string or a `Date` object, it will be parsed and the year will be extracted.
|
|
1368
|
+
* - If a `Chronos` instance is passed, the year will be directly accessed from the instance.
|
|
1353
1369
|
*
|
|
1354
1370
|
* @param date - A `number` (year or Unix timestamp), `string`, `Date`, or `Chronos` instance representing a date.
|
|
1355
1371
|
* @returns `true` if the year is a leap year, `false` otherwise.
|
|
@@ -1379,7 +1395,7 @@ var Chronos = class Chronos {
|
|
|
1379
1395
|
* @returns `true` if the value is a valid date string, otherwise `false`.
|
|
1380
1396
|
*/
|
|
1381
1397
|
static isDateString(value) {
|
|
1382
|
-
return
|
|
1398
|
+
return isDateString(value);
|
|
1383
1399
|
}
|
|
1384
1400
|
/**
|
|
1385
1401
|
* @static Checks if the given value is an instance of `Chronos`.
|
|
@@ -1425,7 +1441,7 @@ var Chronos = class Chronos {
|
|
|
1425
1441
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using {@link register} method (alias `use` method).
|
|
1426
1442
|
*
|
|
1427
1443
|
* - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
|
|
1428
|
-
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
1444
|
+
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1429
1445
|
*/
|
|
1430
1446
|
static use(plugin) {
|
|
1431
1447
|
if (!Chronos.#plugins.has(plugin)) {
|
|
@@ -1443,7 +1459,7 @@ var Chronos = class Chronos {
|
|
|
1443
1459
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using this (`register`) method over {@link use} method.
|
|
1444
1460
|
*
|
|
1445
1461
|
* - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
|
|
1446
|
-
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
1462
|
+
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1447
1463
|
*/
|
|
1448
1464
|
static register(plugin) {
|
|
1449
1465
|
Chronos.use(plugin);
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
|
|
2
18
|
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
3
19
|
function isArray(value) {
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
2
18
|
function isArray(value) {
|
|
3
19
|
return Array.isArray(value);
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_basic = require('../basic-
|
|
3
|
-
const require_primitives = require('../primitives-
|
|
4
|
-
const require_utilities = require('../utilities-
|
|
5
|
-
const require_helpers = require('../helpers-
|
|
18
|
+
const require_basic = require('../basic-DsQqC5nZ.cjs');
|
|
19
|
+
const require_primitives = require('../primitives-CtuSNmV7.cjs');
|
|
20
|
+
const require_utilities = require('../utilities-CpF3uys3.cjs');
|
|
21
|
+
const require_helpers = require('../helpers-CQzi908i.cjs');
|
|
6
22
|
|
|
7
23
|
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/number/convert.js
|
|
8
24
|
function digitToBangla(digit, preserveNonDigit = true) {
|
|
@@ -28,7 +44,7 @@ const banglaPlugin = ($Chronos) => {
|
|
|
28
44
|
function $bnDaysMonthIdx(date, variant) {
|
|
29
45
|
return require_helpers._bnDaysMonthIdx(date, variant ?? DEFAULT_CONFIG.get("config")?.variant);
|
|
30
46
|
}
|
|
31
|
-
$Chronos.prototype
|
|
47
|
+
$Chronos.prototype.$configureBangla = function(configs) {
|
|
32
48
|
DEFAULT_CONFIG.set("config", configs);
|
|
33
49
|
};
|
|
34
50
|
$Chronos.prototype.getBanglaYear = function(locale = "bn") {
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { $t as BanglaDayName, C as $Chronos, Ht as $BanglaMonth, Kt as $BnEn, Qt as BanglaDateOptions, Ut as $BanglaMonthDate, Wt as $BanglaYear, Zt as BanglaDateObject, gn as StrictFormat, in as BnCalendarConfig, nn as BanglaSeasonName, tn as BanglaMonthName } from "../types-CaVuY1_4.cjs";
|
|
2
18
|
|
|
3
19
|
//#region src/plugins/banglaPlugin.d.ts
|
|
4
20
|
declare module 'chronos-date' {
|
|
@@ -208,7 +224,7 @@ declare module 'chronos-date' {
|
|
|
208
224
|
* c2.getBanglaMonth(); // uses 'revised-2019'
|
|
209
225
|
*
|
|
210
226
|
* // Set the global default to 1966 variant
|
|
211
|
-
* c1
|
|
227
|
+
* c1.$configureBangla({ variant: 'revised-1966' });
|
|
212
228
|
*
|
|
213
229
|
* c1.getBanglaMonth(); // now uses 'revised-1966'
|
|
214
230
|
* c2.getBanglaMonth(); // also uses 'revised-1966'
|
|
@@ -216,7 +232,7 @@ declare module 'chronos-date' {
|
|
|
216
232
|
* // Per-call override still works
|
|
217
233
|
* c1.getBanglaMonth({ variant: 'revised-2019' }); // uses 'revised-2019' just for this call
|
|
218
234
|
*/
|
|
219
|
-
|
|
235
|
+
$configureBangla(options: BnCalendarConfig): void;
|
|
220
236
|
}
|
|
221
237
|
}
|
|
222
238
|
/** * Plugin to inject methods related to Bangla calendar system (`Bongabdo`) */
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { $t as BanglaDayName, C as $Chronos, Ht as $BanglaMonth, Kt as $BnEn, Qt as BanglaDateOptions, Ut as $BanglaMonthDate, Wt as $BanglaYear, Zt as BanglaDateObject, gn as StrictFormat, in as BnCalendarConfig, nn as BanglaSeasonName, tn as BanglaMonthName } from "../types-Bs_rfkka.mjs";
|
|
2
18
|
|
|
3
19
|
//#region src/plugins/banglaPlugin.d.ts
|
|
4
20
|
declare module 'chronos-date' {
|
|
@@ -208,7 +224,7 @@ declare module 'chronos-date' {
|
|
|
208
224
|
* c2.getBanglaMonth(); // uses 'revised-2019'
|
|
209
225
|
*
|
|
210
226
|
* // Set the global default to 1966 variant
|
|
211
|
-
* c1
|
|
227
|
+
* c1.$configureBangla({ variant: 'revised-1966' });
|
|
212
228
|
*
|
|
213
229
|
* c1.getBanglaMonth(); // now uses 'revised-1966'
|
|
214
230
|
* c2.getBanglaMonth(); // also uses 'revised-1966'
|
|
@@ -216,7 +232,7 @@ declare module 'chronos-date' {
|
|
|
216
232
|
* // Per-call override still works
|
|
217
233
|
* c1.getBanglaMonth({ variant: 'revised-2019' }); // uses 'revised-2019' just for this call
|
|
218
234
|
*/
|
|
219
|
-
|
|
235
|
+
$configureBangla(options: BnCalendarConfig): void;
|
|
220
236
|
}
|
|
221
237
|
}
|
|
222
238
|
/** * Plugin to inject methods related to Bangla calendar system (`Bongabdo`) */
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { n as BN_MONTHS, s as INTERNALS, t as BN_DAYS } from "../basic-DqKyujoj.mjs";
|
|
18
|
+
import { n as isNonEmptyString, r as isNumber } from "../primitives-dXzXlzJw.mjs";
|
|
19
|
+
import { a as isNumericString, i as BN_DIGITS } from "../utilities-BKtVo78T.mjs";
|
|
20
|
+
import { a as _getBnSeason, d as _padShunno, i as _formatDateCore, l as _isBnLeapYear, o as _getBnYear, t as _bnDaysMonthIdx } from "../helpers-DEf4sevD.mjs";
|
|
5
21
|
|
|
6
22
|
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/number/convert.js
|
|
7
23
|
function digitToBangla(digit, preserveNonDigit = true) {
|
|
@@ -27,7 +43,7 @@ const banglaPlugin = ($Chronos) => {
|
|
|
27
43
|
function $bnDaysMonthIdx(date, variant) {
|
|
28
44
|
return _bnDaysMonthIdx(date, variant ?? DEFAULT_CONFIG.get("config")?.variant);
|
|
29
45
|
}
|
|
30
|
-
$Chronos.prototype
|
|
46
|
+
$Chronos.prototype.$configureBangla = function(configs) {
|
|
31
47
|
DEFAULT_CONFIG.set("config", configs);
|
|
32
48
|
};
|
|
33
49
|
$Chronos.prototype.getBanglaYear = function(locale = "bn") {
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_basic = require('../basic-
|
|
3
|
-
const require_primitives = require('../primitives-
|
|
4
|
-
const require_non_primitives = require('../non-primitives-
|
|
18
|
+
const require_basic = require('../basic-DsQqC5nZ.cjs');
|
|
19
|
+
const require_primitives = require('../primitives-CtuSNmV7.cjs');
|
|
20
|
+
const require_non_primitives = require('../non-primitives-D9zxCwX8.cjs');
|
|
5
21
|
|
|
6
22
|
//#region src/plugins/businessPlugin.ts
|
|
7
23
|
/** * Plugin to inject `business` related methods */
|