chronos-date 1.3.4 → 2.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.
- package/README.md +1 -1
- package/dist/{convert-C58su2-2.cjs → convert-BDQBTK5P.cjs} +3 -3
- package/dist/{convert-CWh7zZ5Q.mjs → convert-D5Cd0cCg.mjs} +3 -3
- package/dist/{greet-DMVrEM6l.cjs → greet-CMkwXJ7o.cjs} +1 -1
- package/dist/{greet-BBVGLAlA.mjs → greet-DNGvP7nm.mjs} +1 -1
- package/dist/guards.cjs +3 -3
- package/dist/guards.d.cts +1 -1
- package/dist/guards.d.mts +1 -1
- package/dist/guards.mjs +3 -3
- package/dist/{helpers-CoVvHHs7.cjs → helpers-Bq7Hczoa.cjs} +3 -3
- package/dist/{helpers-X5e54orr.mjs → helpers-C2spzGZ-.mjs} +3 -3
- package/dist/index.cjs +31 -32
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +31 -32
- package/dist/{non-primitives-D3EcMaah.cjs → non-primitives-BqjRwK2B.cjs} +1 -1
- package/dist/{non-primitives-BG-R5eUB.mjs → non-primitives-CbAOB6lb.mjs} +1 -1
- package/dist/plugins/banglaPlugin.cjs +4 -4
- package/dist/plugins/banglaPlugin.d.cts +2 -2
- package/dist/plugins/banglaPlugin.d.mts +2 -2
- package/dist/plugins/banglaPlugin.mjs +4 -4
- package/dist/plugins/businessPlugin.cjs +4 -4
- package/dist/plugins/businessPlugin.d.cts +3 -3
- package/dist/plugins/businessPlugin.d.mts +3 -3
- package/dist/plugins/businessPlugin.mjs +4 -4
- package/dist/plugins/dateRangePlugin.cjs +2 -2
- package/dist/plugins/dateRangePlugin.d.cts +3 -3
- package/dist/plugins/dateRangePlugin.d.mts +3 -3
- package/dist/plugins/dateRangePlugin.mjs +2 -2
- package/dist/plugins/dayPartPlugin.cjs +1 -1
- package/dist/plugins/dayPartPlugin.d.cts +1 -1
- package/dist/plugins/dayPartPlugin.d.mts +1 -1
- package/dist/plugins/dayPartPlugin.mjs +1 -1
- package/dist/plugins/durationPlugin.d.cts +1 -1
- package/dist/plugins/durationPlugin.d.mts +1 -1
- package/dist/plugins/fromNowPlugin.cjs +1 -1
- package/dist/plugins/fromNowPlugin.d.cts +1 -1
- package/dist/plugins/fromNowPlugin.d.mts +1 -1
- package/dist/plugins/fromNowPlugin.mjs +1 -1
- package/dist/plugins/greetingPlugin.cjs +2 -2
- package/dist/plugins/greetingPlugin.d.cts +3 -3
- package/dist/plugins/greetingPlugin.d.mts +3 -3
- package/dist/plugins/greetingPlugin.mjs +2 -2
- package/dist/plugins/palindromePlugin.cjs +4 -4
- package/dist/plugins/palindromePlugin.d.cts +1 -1
- package/dist/plugins/palindromePlugin.d.mts +1 -1
- package/dist/plugins/palindromePlugin.mjs +4 -4
- package/dist/plugins/relativeTimePlugin.d.cts +1 -1
- package/dist/plugins/relativeTimePlugin.d.mts +1 -1
- package/dist/plugins/roundPlugin.cjs +1 -1
- package/dist/plugins/roundPlugin.d.cts +1 -1
- package/dist/plugins/roundPlugin.d.mts +1 -1
- package/dist/plugins/roundPlugin.mjs +1 -1
- package/dist/plugins/seasonPlugin.d.cts +2 -2
- package/dist/plugins/seasonPlugin.d.mts +2 -2
- package/dist/plugins/timeZonePlugin.cjs +2 -2
- package/dist/plugins/timeZonePlugin.d.cts +1 -1
- package/dist/plugins/timeZonePlugin.d.mts +1 -1
- package/dist/plugins/timeZonePlugin.mjs +2 -2
- package/dist/plugins/zodiacPlugin.cjs +1 -1
- package/dist/plugins/zodiacPlugin.d.cts +2 -2
- package/dist/plugins/zodiacPlugin.d.mts +2 -2
- package/dist/plugins/zodiacPlugin.mjs +1 -1
- package/dist/{primitives-Csc-jgx0.mjs → primitives-BXhrgs9R.mjs} +1 -1
- package/dist/{primitives-Ce8vYVxN.cjs → primitives-DfO90c3G.cjs} +1 -1
- package/dist/{types-36vIWjN1.d.mts → types-Be4ZMpOV.d.mts} +55 -40
- package/dist/{types-DKMN8UeN.d.cts → types-dNpvroNQ.d.cts} +55 -40
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/{utilities-CQORzytW.mjs → utilities-BnHD2hHf.mjs} +4 -4
- package/dist/{utilities-CW4F3wFp.mjs → utilities-C6NiChRE.mjs} +6 -6
- package/dist/{utilities-GTSjQweZ.cjs → utilities-CCnKWAsS.cjs} +6 -6
- package/dist/{utilities-BnJa8S6A.cjs → utilities-C_KmjIRK.cjs} +4 -4
- package/dist/utils.cjs +4 -4
- package/dist/utils.d.cts +4 -4
- package/dist/utils.d.mts +4 -4
- package/dist/utils.mjs +4 -4
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ console.log(now.format('dd, mmm DD, YYYY'));
|
|
|
88
88
|
|
|
89
89
|
// Using the function wrapper
|
|
90
90
|
const tomorrow = chronos().addDays(1);
|
|
91
|
-
console.log(tomorrow.
|
|
91
|
+
console.log(tomorrow.formatSafe('YYYY-MM-DD'));
|
|
92
92
|
|
|
93
93
|
// Calculate differences
|
|
94
94
|
const eventDate = new Chronos('2025-12-31');
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const require_primitives = require('./primitives-
|
|
17
|
+
const require_primitives = require('./primitives-DfO90c3G.cjs');
|
|
18
18
|
|
|
19
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.
|
|
19
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/string/basics.js
|
|
20
20
|
function trimString(input) {
|
|
21
21
|
if (!input) return "";
|
|
22
22
|
if (require_primitives.isNonEmptyString(input)) return input.trim().replace(/\s+/g, " ");
|
|
@@ -25,7 +25,7 @@ function trimString(input) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.
|
|
28
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/string/convert.js
|
|
29
29
|
const reverseString = (input) => {
|
|
30
30
|
return trimString(input)?.split("")?.reverse()?.join("");
|
|
31
31
|
};
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { n as isNonEmptyString } from "./primitives-
|
|
17
|
+
import { n as isNonEmptyString } from "./primitives-BXhrgs9R.mjs";
|
|
18
18
|
|
|
19
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.
|
|
19
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/string/basics.js
|
|
20
20
|
function trimString(input) {
|
|
21
21
|
if (!input) return "";
|
|
22
22
|
if (isNonEmptyString(input)) return input.trim().replace(/\s+/g, " ");
|
|
@@ -25,7 +25,7 @@ function trimString(input) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.
|
|
28
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/string/convert.js
|
|
29
29
|
const reverseString = (input) => {
|
|
30
30
|
return trimString(input)?.split("")?.reverse()?.join("");
|
|
31
31
|
};
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { isValidTime } from "./guards.mjs";
|
|
18
|
-
import { n as extractHourMinute, p as getTotalMinutes } from "./utilities-
|
|
18
|
+
import { n as extractHourMinute, p as getTotalMinutes } from "./utilities-C6NiChRE.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/utils/greet.ts
|
|
21
21
|
/**
|
package/dist/guards.cjs
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_timezone = require('./timezone-BNnHFgki.cjs');
|
|
19
|
-
const require_primitives = require('./primitives-
|
|
20
|
-
const require_non_primitives = require('./non-primitives-
|
|
21
|
-
const require_utilities = require('./utilities-
|
|
19
|
+
const require_primitives = require('./primitives-DfO90c3G.cjs');
|
|
20
|
+
const require_non_primitives = require('./non-primitives-BqjRwK2B.cjs');
|
|
21
|
+
const require_utilities = require('./utilities-C_KmjIRK.cjs');
|
|
22
22
|
|
|
23
23
|
//#region src/guards.ts
|
|
24
24
|
/**
|
package/dist/guards.d.cts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { Cn as Numeric, Mt as TimeZoneIdNative, Ot as TimeWithUnit, Rt as UTCOffset, Z as $TimeZoneIdentifier, it as ClockTime, st as DateLike } from "./types-
|
|
17
|
+
import { Cn as Numeric, Mt as TimeZoneIdNative, Ot as TimeWithUnit, Rt as UTCOffset, Z as $TimeZoneIdentifier, it as ClockTime, st as DateLike } from "./types-dNpvroNQ.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/guards.d.ts
|
|
20
20
|
/**
|
package/dist/guards.d.mts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { Cn as Numeric, Mt as TimeZoneIdNative, Ot as TimeWithUnit, Rt as UTCOffset, Z as $TimeZoneIdentifier, it as ClockTime, st as DateLike } from "./types-
|
|
17
|
+
import { Cn as Numeric, Mt as TimeZoneIdNative, Ot as TimeWithUnit, Rt as UTCOffset, Z as $TimeZoneIdentifier, it as ClockTime, st as DateLike } from "./types-Be4ZMpOV.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/guards.d.ts
|
|
20
20
|
/**
|
package/dist/guards.mjs
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { n as NATIVE_TZ_IDS, t as IANA_TZ_IDS } from "./timezone-Db2CeL32.mjs";
|
|
18
|
-
import { n as isNonEmptyString, t as isBoolean } from "./primitives-
|
|
19
|
-
import { r as isObject, t as isFunction } from "./non-primitives-
|
|
20
|
-
import { a as isNumericString, n as normalizeNumber } from "./utilities-
|
|
18
|
+
import { n as isNonEmptyString, t as isBoolean } from "./primitives-BXhrgs9R.mjs";
|
|
19
|
+
import { r as isObject, t as isFunction } from "./non-primitives-CbAOB6lb.mjs";
|
|
20
|
+
import { a as isNumericString, n as normalizeNumber } from "./utilities-BnHD2hHf.mjs";
|
|
21
21
|
|
|
22
22
|
//#region src/guards.ts
|
|
23
23
|
/**
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const require_basic = require('./basic-DsQqC5nZ.cjs');
|
|
18
|
-
const require_primitives = require('./primitives-
|
|
19
|
-
const require_non_primitives = require('./non-primitives-
|
|
20
|
-
const require_utilities = require('./utilities-
|
|
18
|
+
const require_primitives = require('./primitives-DfO90c3G.cjs');
|
|
19
|
+
const require_non_primitives = require('./non-primitives-BqjRwK2B.cjs');
|
|
20
|
+
const require_utilities = require('./utilities-C_KmjIRK.cjs');
|
|
21
21
|
const require_guards = require('./guards.cjs');
|
|
22
22
|
|
|
23
23
|
//#region src/utils/helpers.ts
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { c as MONTHS, d as SORTED_TIME_FORMATS, i as BN_SEASONS, o as DAYS, r as BN_MONTH_TABLES, u as MS_PER_DAY } from "./basic-DqKyujoj.mjs";
|
|
18
|
-
import { i as isString, n as isNonEmptyString } from "./primitives-
|
|
19
|
-
import { a as isValidArray, i as isObjectWithKeys } from "./non-primitives-
|
|
20
|
-
import { t as getOrdinal } from "./utilities-
|
|
18
|
+
import { i as isString, n as isNonEmptyString } from "./primitives-BXhrgs9R.mjs";
|
|
19
|
+
import { a as isValidArray, i as isObjectWithKeys } from "./non-primitives-CbAOB6lb.mjs";
|
|
20
|
+
import { t as getOrdinal } from "./utilities-BnHD2hHf.mjs";
|
|
21
21
|
import { isDate, isDateString, isLeapYear, isValidUTCOffset } from "./guards.mjs";
|
|
22
22
|
|
|
23
23
|
//#region src/utils/helpers.ts
|
package/dist/index.cjs
CHANGED
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_basic = require('./basic-DsQqC5nZ.cjs');
|
|
19
|
-
const require_primitives = require('./primitives-
|
|
20
|
-
const require_non_primitives = require('./non-primitives-
|
|
19
|
+
const require_primitives = require('./primitives-DfO90c3G.cjs');
|
|
20
|
+
const require_non_primitives = require('./non-primitives-BqjRwK2B.cjs');
|
|
21
21
|
const require_guards = require('./guards.cjs');
|
|
22
|
-
const require_helpers = require('./helpers-
|
|
23
|
-
const require_utilities = require('./utilities-
|
|
22
|
+
const require_helpers = require('./helpers-Bq7Hczoa.cjs');
|
|
23
|
+
const require_utilities = require('./utilities-CCnKWAsS.cjs');
|
|
24
24
|
|
|
25
25
|
//#region src/utils/chronos-fn.ts
|
|
26
26
|
/**
|
|
@@ -216,24 +216,24 @@ var Chronos = class Chronos {
|
|
|
216
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.
|
|
217
217
|
*
|
|
218
218
|
* @remarks
|
|
219
|
-
* - Invoking the {@link https://
|
|
219
|
+
* - Invoking the {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#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://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#gettimezonename getTimeZoneName}.
|
|
220
220
|
* - To retrieve the local system's native timezone name (or its identifier if the name is unavailable), use the {@link $getNativeTimeZoneName} instance method.
|
|
221
221
|
*/
|
|
222
222
|
timeZoneName;
|
|
223
223
|
/**
|
|
224
224
|
* Represents the current timezone context, which can be a single identifier, an array of equivalent identifiers, or a UTC offset.
|
|
225
225
|
*
|
|
226
|
-
* - **{@link $TimeZoneIdentifier}** — e.g., `"Asia/Dhaka"`. Returned when the {@link https://
|
|
226
|
+
* - **{@link $TimeZoneIdentifier}** — e.g., `"Asia/Dhaka"`. Returned when the {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone} method has not been invoked. It is default behavior.
|
|
227
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"`.
|
|
228
228
|
* - **{@link UTCOffset}** — e.g., `"UTC+06:45"` or `"UTC+02:15"`, returned when no named timezone corresponds to a given offset.
|
|
229
229
|
*
|
|
230
230
|
* @remarks
|
|
231
|
-
* - By default, when {@link https://
|
|
231
|
+
* - By default, when {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone} is not applied, a single {@link $TimeZoneIdentifier} string is provided.
|
|
232
232
|
* - When applied, it may instead return a single identifier string, an array of equivalent identifiers or a UTC offset string.
|
|
233
233
|
* - To retrieve the local system's native timezone identifier, use the {@link $getNativeTimeZoneId} instance method.
|
|
234
234
|
*/
|
|
235
235
|
timeZoneId;
|
|
236
|
-
/** Tracker to identify the instance created by {@link https://
|
|
236
|
+
/** Tracker to identify the instance created by {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone} method */
|
|
237
237
|
$tzTracker;
|
|
238
238
|
/**
|
|
239
239
|
* * Creates a new immutable `Chronos` instance.
|
|
@@ -310,7 +310,7 @@ var Chronos = class Chronos {
|
|
|
310
310
|
*
|
|
311
311
|
* @remarks
|
|
312
312
|
* - This method always reflects the local machine's time zone if `tzId` is parameter is omitted.
|
|
313
|
-
* - {@link https://
|
|
313
|
+
* - {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone}, {@link utc}, or {@link toUTC} methods have no effects on this method.
|
|
314
314
|
* - To access the time zone name of a modified or converted instance, use the {@link timeZoneName} public property instead.
|
|
315
315
|
*
|
|
316
316
|
* @param tzId Optional time zone identifier to get time zone name for that specific identifier if available.
|
|
@@ -326,7 +326,7 @@ var Chronos = class Chronos {
|
|
|
326
326
|
*
|
|
327
327
|
* @remarks
|
|
328
328
|
* - This method always returns the identifier of the local machine's time zone.
|
|
329
|
-
* - {@link https://
|
|
329
|
+
* - {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone}, {@link utc}, or {@link toUTC} methods have no effects on this method.
|
|
330
330
|
* - To obtain the identifier(s) of a modified or converted instance, use the {@link timeZoneId} public property instead.
|
|
331
331
|
*
|
|
332
332
|
* @returns The local system's IANA time zone identifier.
|
|
@@ -355,7 +355,7 @@ var Chronos = class Chronos {
|
|
|
355
355
|
* @param offset Optional UTC offset in `UTC±HH:mm` format.
|
|
356
356
|
* @param tzName Optional time zone name to set.
|
|
357
357
|
* @param tzId Optional time zone identifier(s) to set.
|
|
358
|
-
* @param tzTracker Optional tracker to identify the instance created by {@link https://
|
|
358
|
+
* @param tzTracker Optional tracker to identify the instance created by {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone} method.
|
|
359
359
|
* @returns The `Chronos` instance with the specified origin and other properties.
|
|
360
360
|
*/
|
|
361
361
|
#withOrigin(origin, offset, tzName, tzId, tzTracker) {
|
|
@@ -516,7 +516,7 @@ var Chronos = class Chronos {
|
|
|
516
516
|
*
|
|
517
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`.
|
|
518
518
|
* - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
|
|
519
|
-
* - Please refer to {@link https://
|
|
519
|
+
* - Please refer to {@link https://chronos.nazmul-nhb.dev/docs/chronos/format#format-tokens format tokens} for details.
|
|
520
520
|
*
|
|
521
521
|
* @param useUTC - Optional boolean to format the date using UTC time.
|
|
522
522
|
* When `true`, it behaves like `formatUTC()` and outputs time based on UTC offset. Defaults to `false`.
|
|
@@ -534,13 +534,13 @@ var Chronos = class Chronos {
|
|
|
534
534
|
*
|
|
535
535
|
* @param format - The desired format string. Defaults to `'dd, mmm DD, YYYY HH:mm:ss'`
|
|
536
536
|
* (e.g., `'Sun, Apr 06, 2025 16:11:55'`).
|
|
537
|
-
* - Please refer to {@link https://
|
|
537
|
+
* - Please refer to {@link https://chronos.nazmul-nhb.dev/docs/chronos/format#format-tokens format tokens} for details.
|
|
538
538
|
*
|
|
539
539
|
* @param useUTC - If `true`, formats the date in UTC (equivalent to `formatUTC()`).
|
|
540
540
|
* Defaults to `false` (local time).
|
|
541
541
|
* @returns A formatted date string in the specified format.
|
|
542
542
|
*/
|
|
543
|
-
|
|
543
|
+
formatSafe(format, useUTC = false) {
|
|
544
544
|
return this.#format(format || "dd, mmm DD, YYYY HH:mm:ss", useUTC);
|
|
545
545
|
}
|
|
546
546
|
/**
|
|
@@ -553,7 +553,7 @@ var Chronos = class Chronos {
|
|
|
553
553
|
*
|
|
554
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`.
|
|
555
555
|
* - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
|
|
556
|
-
* - Please refer to {@link https://
|
|
556
|
+
* - Please refer to {@link https://chronos.nazmul-nhb.dev/docs/chronos/format#format-tokens format tokens} for details.
|
|
557
557
|
*
|
|
558
558
|
* @returns Formatted date string in desired format (UTC time).
|
|
559
559
|
*/
|
|
@@ -878,14 +878,13 @@ var Chronos = class Chronos {
|
|
|
878
878
|
/**
|
|
879
879
|
* @instance Returns the difference between current and another date in the given unit.
|
|
880
880
|
* @param other The other date to compare.
|
|
881
|
-
* @param unit The unit in which to return the difference.
|
|
881
|
+
* @param unit The unit in which to return the difference. Defaults to `'millisecond'`.
|
|
882
882
|
* @returns Difference in number (either `integer` or `float`).
|
|
883
883
|
*/
|
|
884
|
-
diff(other, unit) {
|
|
884
|
+
diff(other, unit = "millisecond") {
|
|
885
885
|
const time = Chronos.#cast(other);
|
|
886
886
|
const msDiff = this.#timestamp - time.#timestamp;
|
|
887
887
|
switch (unit) {
|
|
888
|
-
case "millisecond": return msDiff;
|
|
889
888
|
case "second": return msDiff / 1e3;
|
|
890
889
|
case "minute": return msDiff / 6e4;
|
|
891
890
|
case "hour": return msDiff / 36e5;
|
|
@@ -897,6 +896,7 @@ var Chronos = class Chronos {
|
|
|
897
896
|
return yearDiff * 12 + monthDiff + (this.date - time.date) / this.daysInMonth();
|
|
898
897
|
}
|
|
899
898
|
case "year": return this.diff(time, "month") / 12;
|
|
899
|
+
default: return msDiff;
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
902
|
/**
|
|
@@ -1019,15 +1019,15 @@ var Chronos = class Chronos {
|
|
|
1019
1019
|
* - `Q3`: July to September
|
|
1020
1020
|
* - `Q4`: October to December
|
|
1021
1021
|
*
|
|
1022
|
-
* This method strictly uses the **calendar year**. For fiscal quarters, use {@link
|
|
1022
|
+
* This method strictly uses the **calendar year**. For fiscal quarters, use {@link https://chronos.nazmul-nhb.dev/docs/plugins/business-plugin#getfiscalquarter getFiscalQuarter} instead.
|
|
1023
1023
|
*
|
|
1024
1024
|
* @example
|
|
1025
|
-
* new Chronos('2025-02-14').
|
|
1026
|
-
* new Chronos('2025-08-09').
|
|
1025
|
+
* new Chronos('2025-02-14').getQuarter(); // 1
|
|
1026
|
+
* new Chronos('2025-08-09').getQuarter(); // 3
|
|
1027
1027
|
*
|
|
1028
1028
|
* @returns The calendar quarter number (1–4).
|
|
1029
1029
|
*/
|
|
1030
|
-
|
|
1030
|
+
getQuarter() {
|
|
1031
1031
|
const month = this.#date.getMonth();
|
|
1032
1032
|
return Math.floor(month / 3) + 1;
|
|
1033
1033
|
}
|
|
@@ -1047,7 +1047,7 @@ var Chronos = class Chronos {
|
|
|
1047
1047
|
/**
|
|
1048
1048
|
* @instance Returns the timezone offset of this `Chronos` instance in `±HH:mm` format maintaining current timezone.
|
|
1049
1049
|
*
|
|
1050
|
-
*
|
|
1050
|
+
* @remarks *Unlike JavaScript's {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset `Date.prototype.getTimezoneOffset()`}, which returns the offset in minutes **behind** UTC (positive for locations west of UTC and negative for east), this method returns the more intuitive sign format used in timezone representations (e.g., `+06:00` means 6 hours **ahead** of UTC).*
|
|
1051
1051
|
*
|
|
1052
1052
|
* @returns The timezone offset string in `±HH:mm` format maintaining the current timezone regardless of system having different one.
|
|
1053
1053
|
*/
|
|
@@ -1055,7 +1055,7 @@ var Chronos = class Chronos {
|
|
|
1055
1055
|
return this.#offset.replace("UTC", "");
|
|
1056
1056
|
}
|
|
1057
1057
|
/**
|
|
1058
|
-
* @instance Gets the difference in minutes between Universal Coordinated Time (UTC) and the time on the local
|
|
1058
|
+
* @instance Gets the difference in minutes between Universal Coordinated Time (UTC) and the time on the local system.
|
|
1059
1059
|
*
|
|
1060
1060
|
* - *Unlike JavaScript's {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset `Date.prototype.getTimezoneOffset()`}, this method returns a positive value if the local time is ahead of UTC, and negative if behind UTC.*
|
|
1061
1061
|
*
|
|
@@ -1067,12 +1067,11 @@ var Chronos = class Chronos {
|
|
|
1067
1067
|
return -this.#date.getTimezoneOffset();
|
|
1068
1068
|
}
|
|
1069
1069
|
/**
|
|
1070
|
-
* @instance Returns the current `Chronos` instance's
|
|
1070
|
+
* @instance Returns the current `Chronos` instance's timezone offset in minutes.
|
|
1071
1071
|
*
|
|
1072
|
-
* This reflects the parsed or stored offset used internally by `Chronos` and follows
|
|
1073
|
-
* sign convention: positive for timezones ahead of UTC, negative for behind.
|
|
1072
|
+
* @remarks This reflects the parsed or stored offset used internally by `Chronos` and follows sign convention: positive for timezones ahead of UTC, negative for behind.
|
|
1074
1073
|
*
|
|
1075
|
-
* @returns The
|
|
1074
|
+
* @returns The timezone offset in minutes maintaining the current timezone regardless of system having different one.
|
|
1076
1075
|
*/
|
|
1077
1076
|
getTimeZoneOffsetMinutes() {
|
|
1078
1077
|
return require_utilities.extractMinutesFromUTC(this.#offset);
|
|
@@ -1272,7 +1271,7 @@ var Chronos = class Chronos {
|
|
|
1272
1271
|
*
|
|
1273
1272
|
* - *Input will default to today's date and assume local timezone if no offset is provided.*
|
|
1274
1273
|
*
|
|
1275
|
-
* @param format - Format tokens accepted by {@link
|
|
1274
|
+
* @param format - Format tokens accepted by {@link formatSafe()} method ({@link TimeOnlyFormat}) for time part only.
|
|
1276
1275
|
* Default: `hh:mm:ss a` → 02:33:36 pm.
|
|
1277
1276
|
* @returns Formatted time string in local (System) time.
|
|
1278
1277
|
*/
|
|
@@ -1286,7 +1285,7 @@ var Chronos = class Chronos {
|
|
|
1286
1285
|
* @param options - Relative range (e.g., 7 days, 4 weeks) or date range (from/to) and output format.
|
|
1287
1286
|
* @returns Array of ISO date strings in the specified format.
|
|
1288
1287
|
*
|
|
1289
|
-
* - Please refer to {@link https://
|
|
1288
|
+
* - Please refer to {@link https://chronos.nazmul-nhb.dev/docs/chronos/static/get-dates-for-day docs} for details.
|
|
1290
1289
|
*/
|
|
1291
1290
|
static getDatesForDay(day, options) {
|
|
1292
1291
|
let startDate = new Chronos(), endDate = startDate.addWeeks(4);
|
|
@@ -1442,7 +1441,7 @@ var Chronos = class Chronos {
|
|
|
1442
1441
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using {@link register} method (alias `use` method).
|
|
1443
1442
|
*
|
|
1444
1443
|
* - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
|
|
1445
|
-
* - See {@link https://
|
|
1444
|
+
* - See {@link https://chronos.nazmul-nhb.dev/docs/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1446
1445
|
*/
|
|
1447
1446
|
static use(plugin) {
|
|
1448
1447
|
if (!Chronos.#plugins.has(plugin)) {
|
|
@@ -1460,7 +1459,7 @@ var Chronos = class Chronos {
|
|
|
1460
1459
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using this (`register`) method over {@link use} method.
|
|
1461
1460
|
*
|
|
1462
1461
|
* - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
|
|
1463
|
-
* - See {@link https://
|
|
1462
|
+
* - See {@link https://chronos.nazmul-nhb.dev/docs/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1464
1463
|
*/
|
|
1465
1464
|
static register(plugin) {
|
|
1466
1465
|
Chronos.use(plugin);
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
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-
|
|
19
|
-
import { t as isFunction } from "./non-primitives-
|
|
18
|
+
import { r as isNumber } from "./primitives-BXhrgs9R.mjs";
|
|
19
|
+
import { t as isFunction } from "./non-primitives-CbAOB6lb.mjs";
|
|
20
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-
|
|
22
|
-
import { l as getNativeTimeZoneId, r as extractMinutesFromUTC } from "./utilities-
|
|
21
|
+
import { c as _hasChronosProperties, n as _dateArgsToDate, p as _resolveNativeTzName, r as _formatDate, u as _normalizeOffset } from "./helpers-C2spzGZ-.mjs";
|
|
22
|
+
import { l as getNativeTimeZoneId, r as extractMinutesFromUTC } from "./utilities-C6NiChRE.mjs";
|
|
23
23
|
|
|
24
24
|
//#region src/utils/chronos-fn.ts
|
|
25
25
|
/**
|
|
@@ -215,24 +215,24 @@ var Chronos = class Chronos {
|
|
|
215
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.
|
|
216
216
|
*
|
|
217
217
|
* @remarks
|
|
218
|
-
* - Invoking the {@link https://
|
|
218
|
+
* - Invoking the {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#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://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#gettimezonename getTimeZoneName}.
|
|
219
219
|
* - To retrieve the local system's native timezone name (or its identifier if the name is unavailable), use the {@link $getNativeTimeZoneName} instance method.
|
|
220
220
|
*/
|
|
221
221
|
timeZoneName;
|
|
222
222
|
/**
|
|
223
223
|
* Represents the current timezone context, which can be a single identifier, an array of equivalent identifiers, or a UTC offset.
|
|
224
224
|
*
|
|
225
|
-
* - **{@link $TimeZoneIdentifier}** — e.g., `"Asia/Dhaka"`. Returned when the {@link https://
|
|
225
|
+
* - **{@link $TimeZoneIdentifier}** — e.g., `"Asia/Dhaka"`. Returned when the {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone} method has not been invoked. It is default behavior.
|
|
226
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"`.
|
|
227
227
|
* - **{@link UTCOffset}** — e.g., `"UTC+06:45"` or `"UTC+02:15"`, returned when no named timezone corresponds to a given offset.
|
|
228
228
|
*
|
|
229
229
|
* @remarks
|
|
230
|
-
* - By default, when {@link https://
|
|
230
|
+
* - By default, when {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone} is not applied, a single {@link $TimeZoneIdentifier} string is provided.
|
|
231
231
|
* - When applied, it may instead return a single identifier string, an array of equivalent identifiers or a UTC offset string.
|
|
232
232
|
* - To retrieve the local system's native timezone identifier, use the {@link $getNativeTimeZoneId} instance method.
|
|
233
233
|
*/
|
|
234
234
|
timeZoneId;
|
|
235
|
-
/** Tracker to identify the instance created by {@link https://
|
|
235
|
+
/** Tracker to identify the instance created by {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone} method */
|
|
236
236
|
$tzTracker;
|
|
237
237
|
/**
|
|
238
238
|
* * Creates a new immutable `Chronos` instance.
|
|
@@ -309,7 +309,7 @@ var Chronos = class Chronos {
|
|
|
309
309
|
*
|
|
310
310
|
* @remarks
|
|
311
311
|
* - This method always reflects the local machine's time zone if `tzId` is parameter is omitted.
|
|
312
|
-
* - {@link https://
|
|
312
|
+
* - {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone}, {@link utc}, or {@link toUTC} methods have no effects on this method.
|
|
313
313
|
* - To access the time zone name of a modified or converted instance, use the {@link timeZoneName} public property instead.
|
|
314
314
|
*
|
|
315
315
|
* @param tzId Optional time zone identifier to get time zone name for that specific identifier if available.
|
|
@@ -325,7 +325,7 @@ var Chronos = class Chronos {
|
|
|
325
325
|
*
|
|
326
326
|
* @remarks
|
|
327
327
|
* - This method always returns the identifier of the local machine's time zone.
|
|
328
|
-
* - {@link https://
|
|
328
|
+
* - {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone}, {@link utc}, or {@link toUTC} methods have no effects on this method.
|
|
329
329
|
* - To obtain the identifier(s) of a modified or converted instance, use the {@link timeZoneId} public property instead.
|
|
330
330
|
*
|
|
331
331
|
* @returns The local system's IANA time zone identifier.
|
|
@@ -354,7 +354,7 @@ var Chronos = class Chronos {
|
|
|
354
354
|
* @param offset Optional UTC offset in `UTC±HH:mm` format.
|
|
355
355
|
* @param tzName Optional time zone name to set.
|
|
356
356
|
* @param tzId Optional time zone identifier(s) to set.
|
|
357
|
-
* @param tzTracker Optional tracker to identify the instance created by {@link https://
|
|
357
|
+
* @param tzTracker Optional tracker to identify the instance created by {@link https://chronos.nazmul-nhb.dev/docs/plugins/timezone-plugin#timezone timeZone} method.
|
|
358
358
|
* @returns The `Chronos` instance with the specified origin and other properties.
|
|
359
359
|
*/
|
|
360
360
|
#withOrigin(origin, offset, tzName, tzId, tzTracker) {
|
|
@@ -515,7 +515,7 @@ var Chronos = class Chronos {
|
|
|
515
515
|
*
|
|
516
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`.
|
|
517
517
|
* - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
|
|
518
|
-
* - Please refer to {@link https://
|
|
518
|
+
* - Please refer to {@link https://chronos.nazmul-nhb.dev/docs/chronos/format#format-tokens format tokens} for details.
|
|
519
519
|
*
|
|
520
520
|
* @param useUTC - Optional boolean to format the date using UTC time.
|
|
521
521
|
* When `true`, it behaves like `formatUTC()` and outputs time based on UTC offset. Defaults to `false`.
|
|
@@ -533,13 +533,13 @@ var Chronos = class Chronos {
|
|
|
533
533
|
*
|
|
534
534
|
* @param format - The desired format string. Defaults to `'dd, mmm DD, YYYY HH:mm:ss'`
|
|
535
535
|
* (e.g., `'Sun, Apr 06, 2025 16:11:55'`).
|
|
536
|
-
* - Please refer to {@link https://
|
|
536
|
+
* - Please refer to {@link https://chronos.nazmul-nhb.dev/docs/chronos/format#format-tokens format tokens} for details.
|
|
537
537
|
*
|
|
538
538
|
* @param useUTC - If `true`, formats the date in UTC (equivalent to `formatUTC()`).
|
|
539
539
|
* Defaults to `false` (local time).
|
|
540
540
|
* @returns A formatted date string in the specified format.
|
|
541
541
|
*/
|
|
542
|
-
|
|
542
|
+
formatSafe(format, useUTC = false) {
|
|
543
543
|
return this.#format(format || "dd, mmm DD, YYYY HH:mm:ss", useUTC);
|
|
544
544
|
}
|
|
545
545
|
/**
|
|
@@ -552,7 +552,7 @@ var Chronos = class Chronos {
|
|
|
552
552
|
*
|
|
553
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`.
|
|
554
554
|
* - *Any token not wrapped in brackets will be parsed and replaced with its corresponding date component.*
|
|
555
|
-
* - Please refer to {@link https://
|
|
555
|
+
* - Please refer to {@link https://chronos.nazmul-nhb.dev/docs/chronos/format#format-tokens format tokens} for details.
|
|
556
556
|
*
|
|
557
557
|
* @returns Formatted date string in desired format (UTC time).
|
|
558
558
|
*/
|
|
@@ -877,14 +877,13 @@ var Chronos = class Chronos {
|
|
|
877
877
|
/**
|
|
878
878
|
* @instance Returns the difference between current and another date in the given unit.
|
|
879
879
|
* @param other The other date to compare.
|
|
880
|
-
* @param unit The unit in which to return the difference.
|
|
880
|
+
* @param unit The unit in which to return the difference. Defaults to `'millisecond'`.
|
|
881
881
|
* @returns Difference in number (either `integer` or `float`).
|
|
882
882
|
*/
|
|
883
|
-
diff(other, unit) {
|
|
883
|
+
diff(other, unit = "millisecond") {
|
|
884
884
|
const time = Chronos.#cast(other);
|
|
885
885
|
const msDiff = this.#timestamp - time.#timestamp;
|
|
886
886
|
switch (unit) {
|
|
887
|
-
case "millisecond": return msDiff;
|
|
888
887
|
case "second": return msDiff / 1e3;
|
|
889
888
|
case "minute": return msDiff / 6e4;
|
|
890
889
|
case "hour": return msDiff / 36e5;
|
|
@@ -896,6 +895,7 @@ var Chronos = class Chronos {
|
|
|
896
895
|
return yearDiff * 12 + monthDiff + (this.date - time.date) / this.daysInMonth();
|
|
897
896
|
}
|
|
898
897
|
case "year": return this.diff(time, "month") / 12;
|
|
898
|
+
default: return msDiff;
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
901
|
/**
|
|
@@ -1018,15 +1018,15 @@ var Chronos = class Chronos {
|
|
|
1018
1018
|
* - `Q3`: July to September
|
|
1019
1019
|
* - `Q4`: October to December
|
|
1020
1020
|
*
|
|
1021
|
-
* This method strictly uses the **calendar year**. For fiscal quarters, use {@link
|
|
1021
|
+
* This method strictly uses the **calendar year**. For fiscal quarters, use {@link https://chronos.nazmul-nhb.dev/docs/plugins/business-plugin#getfiscalquarter getFiscalQuarter} instead.
|
|
1022
1022
|
*
|
|
1023
1023
|
* @example
|
|
1024
|
-
* new Chronos('2025-02-14').
|
|
1025
|
-
* new Chronos('2025-08-09').
|
|
1024
|
+
* new Chronos('2025-02-14').getQuarter(); // 1
|
|
1025
|
+
* new Chronos('2025-08-09').getQuarter(); // 3
|
|
1026
1026
|
*
|
|
1027
1027
|
* @returns The calendar quarter number (1–4).
|
|
1028
1028
|
*/
|
|
1029
|
-
|
|
1029
|
+
getQuarter() {
|
|
1030
1030
|
const month = this.#date.getMonth();
|
|
1031
1031
|
return Math.floor(month / 3) + 1;
|
|
1032
1032
|
}
|
|
@@ -1046,7 +1046,7 @@ var Chronos = class Chronos {
|
|
|
1046
1046
|
/**
|
|
1047
1047
|
* @instance Returns the timezone offset of this `Chronos` instance in `±HH:mm` format maintaining current timezone.
|
|
1048
1048
|
*
|
|
1049
|
-
*
|
|
1049
|
+
* @remarks *Unlike JavaScript's {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset `Date.prototype.getTimezoneOffset()`}, which returns the offset in minutes **behind** UTC (positive for locations west of UTC and negative for east), this method returns the more intuitive sign format used in timezone representations (e.g., `+06:00` means 6 hours **ahead** of UTC).*
|
|
1050
1050
|
*
|
|
1051
1051
|
* @returns The timezone offset string in `±HH:mm` format maintaining the current timezone regardless of system having different one.
|
|
1052
1052
|
*/
|
|
@@ -1054,7 +1054,7 @@ var Chronos = class Chronos {
|
|
|
1054
1054
|
return this.#offset.replace("UTC", "");
|
|
1055
1055
|
}
|
|
1056
1056
|
/**
|
|
1057
|
-
* @instance Gets the difference in minutes between Universal Coordinated Time (UTC) and the time on the local
|
|
1057
|
+
* @instance Gets the difference in minutes between Universal Coordinated Time (UTC) and the time on the local system.
|
|
1058
1058
|
*
|
|
1059
1059
|
* - *Unlike JavaScript's {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset `Date.prototype.getTimezoneOffset()`}, this method returns a positive value if the local time is ahead of UTC, and negative if behind UTC.*
|
|
1060
1060
|
*
|
|
@@ -1066,12 +1066,11 @@ var Chronos = class Chronos {
|
|
|
1066
1066
|
return -this.#date.getTimezoneOffset();
|
|
1067
1067
|
}
|
|
1068
1068
|
/**
|
|
1069
|
-
* @instance Returns the current `Chronos` instance's
|
|
1069
|
+
* @instance Returns the current `Chronos` instance's timezone offset in minutes.
|
|
1070
1070
|
*
|
|
1071
|
-
* This reflects the parsed or stored offset used internally by `Chronos` and follows
|
|
1072
|
-
* sign convention: positive for timezones ahead of UTC, negative for behind.
|
|
1071
|
+
* @remarks This reflects the parsed or stored offset used internally by `Chronos` and follows sign convention: positive for timezones ahead of UTC, negative for behind.
|
|
1073
1072
|
*
|
|
1074
|
-
* @returns The
|
|
1073
|
+
* @returns The timezone offset in minutes maintaining the current timezone regardless of system having different one.
|
|
1075
1074
|
*/
|
|
1076
1075
|
getTimeZoneOffsetMinutes() {
|
|
1077
1076
|
return extractMinutesFromUTC(this.#offset);
|
|
@@ -1271,7 +1270,7 @@ var Chronos = class Chronos {
|
|
|
1271
1270
|
*
|
|
1272
1271
|
* - *Input will default to today's date and assume local timezone if no offset is provided.*
|
|
1273
1272
|
*
|
|
1274
|
-
* @param format - Format tokens accepted by {@link
|
|
1273
|
+
* @param format - Format tokens accepted by {@link formatSafe()} method ({@link TimeOnlyFormat}) for time part only.
|
|
1275
1274
|
* Default: `hh:mm:ss a` → 02:33:36 pm.
|
|
1276
1275
|
* @returns Formatted time string in local (System) time.
|
|
1277
1276
|
*/
|
|
@@ -1285,7 +1284,7 @@ var Chronos = class Chronos {
|
|
|
1285
1284
|
* @param options - Relative range (e.g., 7 days, 4 weeks) or date range (from/to) and output format.
|
|
1286
1285
|
* @returns Array of ISO date strings in the specified format.
|
|
1287
1286
|
*
|
|
1288
|
-
* - Please refer to {@link https://
|
|
1287
|
+
* - Please refer to {@link https://chronos.nazmul-nhb.dev/docs/chronos/static/get-dates-for-day docs} for details.
|
|
1289
1288
|
*/
|
|
1290
1289
|
static getDatesForDay(day, options) {
|
|
1291
1290
|
let startDate = new Chronos(), endDate = startDate.addWeeks(4);
|
|
@@ -1441,7 +1440,7 @@ var Chronos = class Chronos {
|
|
|
1441
1440
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using {@link register} method (alias `use` method).
|
|
1442
1441
|
*
|
|
1443
1442
|
* - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
|
|
1444
|
-
* - See {@link https://
|
|
1443
|
+
* - See {@link https://chronos.nazmul-nhb.dev/docs/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1445
1444
|
*/
|
|
1446
1445
|
static use(plugin) {
|
|
1447
1446
|
if (!Chronos.#plugins.has(plugin)) {
|
|
@@ -1459,7 +1458,7 @@ var Chronos = class Chronos {
|
|
|
1459
1458
|
* - To prevent this incorrect *linter error* in `React` projects, prefer using this (`register`) method over {@link use} method.
|
|
1460
1459
|
*
|
|
1461
1460
|
* - **NOTE:** *Once a plugin is injected, all the registered methods for that plugin will be available for the whole project.*
|
|
1462
|
-
* - See {@link https://
|
|
1461
|
+
* - See {@link https://chronos.nazmul-nhb.dev/docs/plugins#-official-plugins full list of plugins and the methods they register}.
|
|
1463
1462
|
*/
|
|
1464
1463
|
static register(plugin) {
|
|
1465
1464
|
Chronos.use(plugin);
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.
|
|
18
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
19
19
|
function isArray(value) {
|
|
20
20
|
return Array.isArray(value);
|
|
21
21
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.
|
|
17
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
18
18
|
function isArray(value) {
|
|
19
19
|
return Array.isArray(value);
|
|
20
20
|
}
|