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
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
|
|
18
|
+
function isNumber(value) {
|
|
19
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
20
|
+
}
|
|
21
|
+
function isString(value) {
|
|
22
|
+
return typeof value === "string";
|
|
23
|
+
}
|
|
24
|
+
function isBoolean(value) {
|
|
25
|
+
return typeof value === "boolean";
|
|
26
|
+
}
|
|
27
|
+
function isUndefined(value) {
|
|
28
|
+
return value === void 0;
|
|
29
|
+
}
|
|
30
|
+
function isNonEmptyString(value) {
|
|
31
|
+
return isString(value) && value?.length > 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { isUndefined as a, isString as i, isNonEmptyString as n, isNumber as r, isBoolean as t };
|
|
@@ -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 src/constants/seasons.ts
|
|
3
19
|
/** Western Seasons */
|
|
@@ -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 src/constants/basic.d.ts
|
|
2
18
|
/** @internal Symbol for accessing Chronos internals (plugin author use only) */
|
|
3
19
|
declare const INTERNALS: unique symbol;
|
|
@@ -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 src/constants/basic.d.ts
|
|
2
18
|
/** @internal Symbol for accessing Chronos internals (plugin author use only) */
|
|
3
19
|
declare const INTERNALS: unique symbol;
|
|
@@ -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 src/constants/seasons.ts
|
|
2
18
|
/** Western Seasons */
|
|
3
19
|
const DEFAULT_SEASONS = /* @__PURE__ */ Object.freeze([
|
|
@@ -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 src/constants/timezone.ts
|
|
3
19
|
/** Record of `212` time-zones (abbreviation of timezone names from {@link https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations time zone abbreviations on Wikipedia}) with respective time-zone offsets and full timezone names. */
|
|
@@ -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 src/constants/timezone.ts
|
|
2
18
|
/** Record of `212` time-zones (abbreviation of timezone names from {@link https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations time zone abbreviations on Wikipedia}) with respective time-zone offsets and full timezone names. */
|
|
3
19
|
const TIME_ZONES = /* @__PURE__ */ Object.freeze({
|
|
@@ -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 { 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-B_kjFWIX.mjs";
|
|
2
18
|
|
|
3
19
|
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/dts/utils/types.d.ts
|
|
4
20
|
/**
|
|
@@ -538,24 +554,24 @@ declare class Chronos {
|
|
|
538
554
|
* 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
555
|
*
|
|
540
556
|
* @remarks
|
|
541
|
-
* - Invoking the {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
557
|
+
* - 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
558
|
* - To retrieve the local system's native timezone name (or its identifier if the name is unavailable), use the {@link $getNativeTimeZoneName} instance method.
|
|
543
559
|
*/
|
|
544
560
|
timeZoneName: LooseLiteral<TimeZoneName>;
|
|
545
561
|
/**
|
|
546
562
|
* Represents the current timezone context, which can be a single identifier, an array of equivalent identifiers, or a UTC offset.
|
|
547
563
|
*
|
|
548
|
-
* - **{@link $TimeZoneIdentifier}** — e.g., `"Asia/Dhaka"`. Returned when the {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
564
|
+
* - **{@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
565
|
* - **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
566
|
* - **{@link UTCOffset}** — e.g., `"UTC+06:45"` or `"UTC+02:15"`, returned when no named timezone corresponds to a given offset.
|
|
551
567
|
*
|
|
552
568
|
* @remarks
|
|
553
|
-
* - By default, when {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
569
|
+
* - 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
570
|
* - When applied, it may instead return a single identifier string, an array of equivalent identifiers or a UTC offset string.
|
|
555
571
|
* - To retrieve the local system's native timezone identifier, use the {@link $getNativeTimeZoneId} instance method.
|
|
556
572
|
*/
|
|
557
573
|
timeZoneId: TimeZoneId;
|
|
558
|
-
/** Tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
574
|
+
/** Tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/conversion#timezone timeZone} method */
|
|
559
575
|
protected $tzTracker?: $TimeZoneIdentifier | TimeZone | UTCOffset;
|
|
560
576
|
/**
|
|
561
577
|
* * Creates a new immutable `Chronos` instance from current date & time (UTC).
|
|
@@ -640,7 +656,7 @@ declare class Chronos {
|
|
|
640
656
|
*
|
|
641
657
|
* @remarks
|
|
642
658
|
* - 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/
|
|
659
|
+
* - {@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
660
|
* - To access the time zone name of a modified or converted instance, use the {@link timeZoneName} public property instead.
|
|
645
661
|
*
|
|
646
662
|
* @param tzId Optional time zone identifier to get time zone name for that specific identifier if available.
|
|
@@ -653,7 +669,7 @@ declare class Chronos {
|
|
|
653
669
|
*
|
|
654
670
|
* @remarks
|
|
655
671
|
* - This method always returns the identifier of the local machine's time zone.
|
|
656
|
-
* - {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
672
|
+
* - {@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
673
|
* - To obtain the identifier(s) of a modified or converted instance, use the {@link timeZoneId} public property instead.
|
|
658
674
|
*
|
|
659
675
|
* @returns The local system's IANA time zone identifier.
|
|
@@ -698,7 +714,7 @@ declare class Chronos {
|
|
|
698
714
|
/** @instance Returns a string representation of a date. */
|
|
699
715
|
toString(): string;
|
|
700
716
|
/** @instance Returns ISO time string in appropriate time zone with offset. */
|
|
701
|
-
toLocalISOString():
|
|
717
|
+
toLocalISOString(): ISODateTimeString<'local'>;
|
|
702
718
|
/** @instance Returns a date as a string value in ISO format (UTC). */
|
|
703
719
|
toISOString(): ISODateTimeString;
|
|
704
720
|
/**
|
|
@@ -721,7 +737,7 @@ declare class Chronos {
|
|
|
721
737
|
*
|
|
722
738
|
* - 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
739
|
* - *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/
|
|
740
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/format#format-tokens format tokens} for details.
|
|
725
741
|
*
|
|
726
742
|
* @param useUTC - Optional boolean to format the date using UTC time.
|
|
727
743
|
* When `true`, it behaves like `formatUTC()` and outputs time based on UTC offset. Defaults to `false`.
|
|
@@ -737,7 +753,7 @@ declare class Chronos {
|
|
|
737
753
|
*
|
|
738
754
|
* @param format - The desired format string. Defaults to `'dd, mmm DD, YYYY HH:mm:ss'`
|
|
739
755
|
* (e.g., `'Sun, Apr 06, 2025 16:11:55'`).
|
|
740
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
756
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/format#format-tokens format tokens} for details.
|
|
741
757
|
*
|
|
742
758
|
* @param useUTC - If `true`, formats the date in UTC (equivalent to `formatUTC()`).
|
|
743
759
|
* Defaults to `false` (local time).
|
|
@@ -754,7 +770,7 @@ declare class Chronos {
|
|
|
754
770
|
*
|
|
755
771
|
* - 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
772
|
* - *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/
|
|
773
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/format#format-tokens format tokens} for details.
|
|
758
774
|
*
|
|
759
775
|
* @returns Formatted date string in desired format (UTC time).
|
|
760
776
|
*/
|
|
@@ -1107,8 +1123,8 @@ declare class Chronos {
|
|
|
1107
1123
|
static tomorrow(): Chronos;
|
|
1108
1124
|
/**
|
|
1109
1125
|
* @static Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
|
|
1110
|
-
* * It basically calls {@link Date.now()}.
|
|
1111
1126
|
* @returns The number of milliseconds elapsed since the Unix epoch.
|
|
1127
|
+
* @remarks It internally uses {@link Date.now()}.
|
|
1112
1128
|
*/
|
|
1113
1129
|
static now(): number;
|
|
1114
1130
|
/**
|
|
@@ -1150,7 +1166,7 @@ declare class Chronos {
|
|
|
1150
1166
|
* @param options - Relative range (e.g., 7 days, 4 weeks) and output format (local with timezone or utc).
|
|
1151
1167
|
* @returns Array of ISO date strings in the specified format. Returns empty array if no matches in the time span.
|
|
1152
1168
|
*
|
|
1153
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
1169
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/statics#getdatesforday docs} for details.
|
|
1154
1170
|
*
|
|
1155
1171
|
* @example
|
|
1156
1172
|
* Chronos.getDatesForDay('Wednesday', { span: 7, unit: 'day' });
|
|
@@ -1172,7 +1188,7 @@ declare class Chronos {
|
|
|
1172
1188
|
* @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
1189
|
* @returns Array of ISO date strings in the specified format. Returns empty array if no matches in the range.
|
|
1174
1190
|
*
|
|
1175
|
-
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/
|
|
1191
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/statics#getdatesforday docs} for details.
|
|
1176
1192
|
*
|
|
1177
1193
|
* @remarks
|
|
1178
1194
|
* - When using `Chronos` instances for `from` and/or `to`, ensure both are created in the **same time zone** to avoid mismatched boundaries.
|
|
@@ -1218,12 +1234,12 @@ declare class Chronos {
|
|
|
1218
1234
|
* - 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
1235
|
* - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not.
|
|
1220
1236
|
*
|
|
1221
|
-
* @
|
|
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.
|
|
1237
|
+
* @remarks
|
|
1238
|
+
* - This method accepts different types of date inputs and extracts the year to check if it's a leap year.
|
|
1239
|
+
* - If the provided date is a `number`, it will be treated as a year (must be a valid year from 0 to 9999).
|
|
1240
|
+
* - If the year is out of this range (negative or larger than 9999), it will be treated as a Unix timestamp.
|
|
1241
|
+
* - If the provided date is a string or a `Date` object, it will be parsed and the year will be extracted.
|
|
1242
|
+
* - If a `Chronos` instance is passed, the year will be directly accessed from the instance.
|
|
1227
1243
|
*
|
|
1228
1244
|
* @param date - A `number` (year or Unix timestamp), `string`, `Date`, or `Chronos` instance representing a date.
|
|
1229
1245
|
* @returns `true` if the year is a leap year, `false` otherwise.
|
|
@@ -1278,7 +1294,7 @@ declare class Chronos {
|
|
|
1278
1294
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using {@link register} method (alias `use` method).
|
|
1279
1295
|
*
|
|
1280
1296
|
* - **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/
|
|
1297
|
+
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1282
1298
|
*/
|
|
1283
1299
|
static use(plugin: ChronosPlugin): void;
|
|
1284
1300
|
/**
|
|
@@ -1291,7 +1307,7 @@ declare class Chronos {
|
|
|
1291
1307
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using this (`register`) method over {@link use} method.
|
|
1292
1308
|
*
|
|
1293
1309
|
* - **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/
|
|
1310
|
+
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1295
1311
|
*/
|
|
1296
1312
|
static register(plugin: ChronosPlugin): void;
|
|
1297
1313
|
}
|
|
@@ -1389,7 +1405,7 @@ interface ChronosStatics {
|
|
|
1389
1405
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using {@link register} method (alias `use` method).
|
|
1390
1406
|
*
|
|
1391
1407
|
* - **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/
|
|
1408
|
+
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1393
1409
|
*/
|
|
1394
1410
|
use(plugin: ChronosPlugin): void;
|
|
1395
1411
|
/**
|
|
@@ -1402,7 +1418,7 @@ interface ChronosStatics {
|
|
|
1402
1418
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using this (`register`) method over {@link use} method.
|
|
1403
1419
|
*
|
|
1404
1420
|
* - **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/
|
|
1421
|
+
* - See {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1406
1422
|
*/
|
|
1407
1423
|
register(plugin: ChronosPlugin): void;
|
|
1408
1424
|
/**
|
|
@@ -1717,15 +1733,13 @@ type UTCOffset = `UTC${$UTCOffset}`;
|
|
|
1717
1733
|
/** GMT offset in `GMT±HH:mm` or simply `GMT` format */
|
|
1718
1734
|
type $GMTOffset = `GMT${$UTCOffset}` | 'GMT';
|
|
1719
1735
|
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}`;
|
|
1736
|
+
type ISODateTimeString<F extends ISODateFormat = 'utc'> = F extends 'utc' ? `${$ISOTimeString}Z` : `${$ISOTimeString}${$UTCOffset}`;
|
|
1723
1737
|
/** Valid argument type accepted by `Date` constructor */
|
|
1724
1738
|
type DateArgs = string | number | Date;
|
|
1725
1739
|
/** Type for ISO date format options */
|
|
1726
1740
|
type ISODateFormat = 'local' | 'utc';
|
|
1727
1741
|
/** Options for `getTimestamp` utility */
|
|
1728
|
-
interface TimestampOptions {
|
|
1742
|
+
interface TimestampOptions<F extends ISODateFormat = 'utc'> {
|
|
1729
1743
|
/**
|
|
1730
1744
|
* Optional date input (string, number, or `Date` object).
|
|
1731
1745
|
* Defaults to {@link Date new Date()}.
|
|
@@ -1736,7 +1750,7 @@ interface TimestampOptions {
|
|
|
1736
1750
|
* - `'utc'` (default) → returns ISO string in UTC (`...Z`).
|
|
1737
1751
|
* - `'local'` → returns ISO string with current system offset (`...+05:30`).
|
|
1738
1752
|
*/
|
|
1739
|
-
format?: ISODateFormat;
|
|
1753
|
+
format?: F | ISODateFormat;
|
|
1740
1754
|
}
|
|
1741
1755
|
/** `Chronos` Date Format options */
|
|
1742
1756
|
interface FormatOptions {
|
|
@@ -1748,7 +1762,7 @@ interface FormatOptions {
|
|
|
1748
1762
|
*
|
|
1749
1763
|
* - 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
1764
|
* - *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/
|
|
1765
|
+
* - Please refer to {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/format#format-tokens format tokens} for details.
|
|
1752
1766
|
*/
|
|
1753
1767
|
format?: string;
|
|
1754
1768
|
/** - Whether to use UTC time. Defaults to `false`. */
|
|
@@ -1835,7 +1849,7 @@ interface ChronosInternals {
|
|
|
1835
1849
|
* @param offset Optional UTC offset in `UTC±HH:mm` format.
|
|
1836
1850
|
* @param tzName Optional time zone name to set.
|
|
1837
1851
|
* @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/
|
|
1852
|
+
* @param tzTracker Optional tracker to identify the instance created by {@link https://toolbox.nazmul-nhb.dev/docs/classes/chronos/conversion#timezone timeZone} method.
|
|
1839
1853
|
* @returns The `Chronos` instance with the specified origin and other properties.
|
|
1840
1854
|
*/
|
|
1841
1855
|
withOrigin(instance: Chronos, method: PluginMethods, offset?: UTCOffset, tzName?: LooseLiteral<TimeZoneName>, tzId?: TimeZoneId, tzTracker?: $TimeZoneIdentifier | TimeZone | UTCOffset): Chronos;
|
|
@@ -2120,4 +2134,4 @@ interface DurationOptions {
|
|
|
2120
2134
|
showZero?: boolean;
|
|
2121
2135
|
}
|
|
2122
2136
|
//#endregion
|
|
2123
|
-
export { ChronosStaticKey as $,
|
|
2137
|
+
export { ChronosStaticKey as $, BanglaDayName as $t, ChronosObject as A, TimeZoneId as At, WithoutOrigin as B, Chronos as Bt, $Chronos as C, Enumerate as Cn, PositiveUTCHour as Ct, ChronosInput as D, TimeWithUnit as Dt, $StaticMethods as E, RangeTuple as En, TimeUnitValue as Et, PluginMethods as F, TimestampOptions as Ft, $NativeTzNameOrId as G, $BnDatePadded as Gt, $GMTOffset as H, $BanglaMonth as Ht, RangeWithDates as I, UTCMinute as It, $TimeUnitVar as J, $BnYearPadded as Jt, $TZLabelKey as K, $BnEn as Kt, RelativeDateRange as L, UTCOffset as Lt, ChronosWithOptions as M, TimeZoneIdentifier as Mt, DateRangeOptions as N, TimeZoneName as Nt, ChronosInternals as O, TimeZone as Ot, DatesInRangeOptions as P, TimeZoneNameNative as Pt, $UnitAnyCase as Q, BanglaDateOptions as Qt, RelativeRangeOptions as R, WeekDay as Rt, ZodiacSign as S, Numeric as Sn, NumberingSystem as St, $PluginMethods as T, LooseLiteral as Tn, TimeUnit as Tt, $ISOTimeString as U, $BanglaMonthDate as Ut, $DateUnit as V, chronos as Vt, $LocalArguments as W, $BanglaYear as Wt, $TimeZoneIdentifier as X, BanglaDateFormat as Xt, $TimeUnitVarMap as Y, BanglaDate as Yt, $UTCOffset as Z, BanglaDateObject as Zt, ZodiacArray as _, TimeFormatToken as _n, Milliseconds as _t, BusinessOptionsWeekends as a, BnCalendarVariant as an, DateFormatOptions as at, ZodiacOptions as b, YearToken as bn, MonthString as bt, DayPart as c, DateToken as cn, DateTimeFormatOptions as ct, DurationOptions as d, HourToken as dn, GreetingConfigs as dt, BanglaMonth as en, ClockHour as et, MonthBoundary as f, MSToken as fn, HourMinutes as ft, TimeDuration as g, StrictFormat as gn, LocalesArguments as gt, SeasonPreset as h, SecondToken as hn, LocaleCalendar as ht, BusinessOptionsBasic as i, BnCalendarConfig as in, DateArgs as it, ChronosProperties as j, TimeZoneIdNative as jt, ChronosMethods as k, TimeZoneDetails as kt, DayPartConfig as l, DayToken as ln, FormatOptions as lt, SeasonOptions as m, MonthToken as mn, ISODateTimeString as mt, $BusinessHourOptions as n, BanglaSeasonName as nn, ClockSecond as nt, ChronosPlugin as o, DateWithSeasonToken as on, DateLike as ot, SeasonDefinition as p, MinuteToken as pn, ISODateFormat as pt, $TimeUnitKey as q, $BnMonthPadded as qt, AcademicYear as r, BanglaYear as rn, ClockTime as rt, DateBoundary as s, DateFormatToken as sn, DateString as st, $BusinessHourBaseOptions as t, BanglaMonthName as tn, ClockMinute as tt, DurationKey as u, FormatToken as un, FromNowUnit as ut, ZodiacMeta as v, TimeOnlyFormat as vn, MonthDateString as vt, $InstanceMethods as w, NumberRange as wn, Quarter as wt, ZodiacPreset as x, Maybe as xn, NegativeUTCHour as xt, ZodiacMetaOptions as y, TimeToken as yn, MonthName as yt, WeekdayOptions as z, ChronosStatics as zt };
|