chronos-date 2.0.2 → 2.1.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 +12 -2
- package/dist/constants.d.mts +1 -1
- package/dist/convert-C8LsoKmI-Blf3eLS6.mjs +285 -0
- package/dist/convert-C8LsoKmI-uBhT5hZQ.cjs +387 -0
- package/dist/dist-BPHYJA0t.mjs +70 -0
- package/dist/dist-CdMlZMZa.cjs +75 -0
- package/dist/{greet-DNGvP7nm.mjs → greet-BC86-X9W.mjs} +2 -2
- package/dist/{greet-CMkwXJ7o.cjs → greet-Brz0CVv1.cjs} +8 -8
- package/dist/guards-DTI799nG.mjs +46 -0
- package/dist/guards-dH9JJIso.cjs +51 -0
- package/dist/guards.cjs +14 -16
- package/dist/guards.d.cts +1 -1
- package/dist/guards.d.mts +1 -1
- package/dist/guards.mjs +1 -3
- package/dist/{helpers-Bq7Hczoa.cjs → helpers-BMDeRLjO.cjs} +6 -8
- package/dist/{helpers-C2spzGZ-.mjs → helpers-t49KkxOE.mjs} +2 -4
- package/dist/index.cjs +13 -14
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -5
- package/dist/plugins/banglaPlugin.cjs +16 -33
- package/dist/plugins/banglaPlugin.d.cts +1 -1
- package/dist/plugins/banglaPlugin.d.mts +1 -1
- package/dist/plugins/banglaPlugin.mjs +2 -19
- package/dist/plugins/businessPlugin.cjs +4 -5
- package/dist/plugins/businessPlugin.d.cts +1 -1
- package/dist/plugins/businessPlugin.d.mts +1 -1
- package/dist/plugins/businessPlugin.mjs +1 -2
- package/dist/plugins/dateRangePlugin.cjs +4 -5
- package/dist/plugins/dateRangePlugin.d.cts +1 -1
- package/dist/plugins/dateRangePlugin.d.mts +1 -1
- package/dist/plugins/dateRangePlugin.mjs +1 -2
- package/dist/plugins/dayPartPlugin.cjs +2 -2
- 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 +2 -2
- 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 +1 -1
- package/dist/plugins/greetingPlugin.d.cts +1 -1
- package/dist/plugins/greetingPlugin.d.mts +1 -1
- package/dist/plugins/greetingPlugin.mjs +1 -1
- package/dist/plugins/palindromePlugin.cjs +2 -9
- package/dist/plugins/palindromePlugin.d.cts +1 -1
- package/dist/plugins/palindromePlugin.d.mts +1 -1
- package/dist/plugins/palindromePlugin.mjs +1 -8
- package/dist/plugins/relativeTimePlugin.d.cts +1 -1
- package/dist/plugins/relativeTimePlugin.d.mts +1 -1
- package/dist/plugins/roundPlugin.cjs +8 -8
- 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 +1 -1
- package/dist/plugins/seasonPlugin.d.mts +1 -1
- package/dist/plugins/timeZonePlugin.cjs +3 -3
- 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 +1 -1
- package/dist/plugins/zodiacPlugin.d.mts +1 -1
- package/dist/plugins/zodiacPlugin.mjs +1 -1
- package/dist/{types-Be4ZMpOV.d.mts → types-CiFnGEL8.d.mts} +967 -902
- package/dist/{types-dNpvroNQ.d.cts → types-zhhEJ8N7.d.cts} +966 -901
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/{utilities-C6NiChRE.mjs → utils-DBy7S7hH.mjs} +3 -5
- package/dist/{utilities-CCnKWAsS.cjs → utils-S_aw0TeC.cjs} +8 -10
- package/dist/utils.cjs +33 -34
- package/dist/utils.d.cts +4 -4
- package/dist/utils.d.mts +4 -4
- package/dist/utils.mjs +4 -5
- package/package.json +3 -3
- package/dist/convert-BDQBTK5P.cjs +0 -49
- package/dist/convert-D5Cd0cCg.mjs +0 -38
- package/dist/non-primitives-BqjRwK2B.cjs +0 -68
- package/dist/non-primitives-CbAOB6lb.mjs +0 -38
- package/dist/primitives-BXhrgs9R.mjs +0 -35
- package/dist/primitives-DfO90c3G.cjs +0 -65
- package/dist/utilities-BnHD2hHf.mjs +0 -59
- package/dist/utilities-C_KmjIRK.cjs +0 -88
- /package/dist/{seasons-B_kjFWIX.d.mts → seasons-DYk2jvtn.d.mts} +0 -0
package/dist/guards.cjs
CHANGED
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_timezone = require('./timezone-BNnHFgki.cjs');
|
|
19
|
-
const
|
|
20
|
-
const require_non_primitives = require('./non-primitives-BqjRwK2B.cjs');
|
|
21
|
-
const require_utilities = require('./utilities-C_KmjIRK.cjs');
|
|
19
|
+
const require_convert_C8LsoKmI = require('./convert-C8LsoKmI-uBhT5hZQ.cjs');
|
|
22
20
|
|
|
23
21
|
//#region src/guards.ts
|
|
24
22
|
/**
|
|
@@ -35,7 +33,7 @@ function isDate(value) {
|
|
|
35
33
|
* @returns `true` if the value is a valid date string, otherwise `false`.
|
|
36
34
|
*/
|
|
37
35
|
function isDateString(value) {
|
|
38
|
-
return
|
|
36
|
+
return require_convert_C8LsoKmI.isNonEmptyString(value) && !isNaN(Date.parse(value));
|
|
39
37
|
}
|
|
40
38
|
/**
|
|
41
39
|
* * Checks if the provided value is a valid time string in "HH:MM" format.
|
|
@@ -44,9 +42,9 @@ function isDateString(value) {
|
|
|
44
42
|
* @returns `true` if the value is a valid time string, `false` otherwise.
|
|
45
43
|
*/
|
|
46
44
|
function isValidTime(value) {
|
|
47
|
-
if (!
|
|
45
|
+
if (!require_convert_C8LsoKmI.isNonEmptyString(value)) return false;
|
|
48
46
|
const [hourStr, minuteStr] = value.split(":");
|
|
49
|
-
if (!
|
|
47
|
+
if (!require_convert_C8LsoKmI.isNumericString(hourStr) || !require_convert_C8LsoKmI.isNumericString(minuteStr)) return false;
|
|
50
48
|
const hour = Number(hourStr);
|
|
51
49
|
const minute = Number(minuteStr);
|
|
52
50
|
return hour >= 0 && hour <= 23 && minute >= 0 && minute <= 59;
|
|
@@ -58,7 +56,7 @@ function isValidTime(value) {
|
|
|
58
56
|
* @returns `true` if the value is a valid utc offset, `false` otherwise.
|
|
59
57
|
*/
|
|
60
58
|
function isValidUTCOffset(value) {
|
|
61
|
-
return
|
|
59
|
+
return require_convert_C8LsoKmI.isNonEmptyString(value) ? /^UTC[+-]?\d{1,2}:\d{2}$/.test(value) : false;
|
|
62
60
|
}
|
|
63
61
|
/**
|
|
64
62
|
* * Validates whether the provided value is a recognized IANA time zone identifier (excluding `"Factory"`), based on the {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones IANA TZ Database}.
|
|
@@ -71,7 +69,7 @@ function isValidUTCOffset(value) {
|
|
|
71
69
|
* @returns `true` if the value is a valid IANA time zone identifier, otherwise `false`.
|
|
72
70
|
*/
|
|
73
71
|
function isValidTimeZoneId(value) {
|
|
74
|
-
return
|
|
72
|
+
return require_convert_C8LsoKmI.isNonEmptyString(value) ? new Set([...require_timezone.IANA_TZ_IDS]).has(value) : false;
|
|
75
73
|
}
|
|
76
74
|
/**
|
|
77
75
|
* * Validates whether the provided value is a supported time zone identifier using the native JavaScript API (`Intl.supportedValuesOf('timeZone')`).
|
|
@@ -85,7 +83,7 @@ function isValidTimeZoneId(value) {
|
|
|
85
83
|
* @returns `true` if the value is a valid native JS-supported time zone identifier, otherwise `false`.
|
|
86
84
|
*/
|
|
87
85
|
function isNativeTimeZoneId(value) {
|
|
88
|
-
return
|
|
86
|
+
return require_convert_C8LsoKmI.isNonEmptyString(value) ? new Set(require_timezone.NATIVE_TZ_IDS).has(value) : false;
|
|
89
87
|
}
|
|
90
88
|
/**
|
|
91
89
|
* * Checks if the year is a leap year.
|
|
@@ -96,7 +94,7 @@ function isNativeTimeZoneId(value) {
|
|
|
96
94
|
* @returns `true` if the year is a leap year, `false` otherwise.
|
|
97
95
|
*/
|
|
98
96
|
function isLeapYear(year) {
|
|
99
|
-
const $year =
|
|
97
|
+
const $year = require_convert_C8LsoKmI.normalizeNumber(year);
|
|
100
98
|
return $year ? $year % 4 === 0 && $year % 100 !== 0 || $year % 400 === 0 : false;
|
|
101
99
|
}
|
|
102
100
|
/**
|
|
@@ -106,11 +104,11 @@ function isLeapYear(year) {
|
|
|
106
104
|
*/
|
|
107
105
|
function isDateLike(value) {
|
|
108
106
|
if (value instanceof Date) return true;
|
|
109
|
-
if (
|
|
110
|
-
if (
|
|
111
|
-
if (
|
|
112
|
-
if (
|
|
113
|
-
if (
|
|
107
|
+
if (require_convert_C8LsoKmI.isObject(value)) {
|
|
108
|
+
if (require_convert_C8LsoKmI.isFunction(value?.format) && require_convert_C8LsoKmI.isFunction(value?.toJSON) && require_convert_C8LsoKmI.isFunction(value?.toISOString)) return true;
|
|
109
|
+
if (require_convert_C8LsoKmI.isFunction(value?.toISO) && require_convert_C8LsoKmI.isFunction(value?.toFormat) && require_convert_C8LsoKmI.isBoolean(value?.isValid)) return true;
|
|
110
|
+
if (require_convert_C8LsoKmI.isFunction(value?.plus) && require_convert_C8LsoKmI.isFunction(value?.minus) && require_convert_C8LsoKmI.isFunction(value?.equals) && require_convert_C8LsoKmI.isFunction(value?.getClass)) return true;
|
|
111
|
+
if (require_convert_C8LsoKmI.isFunction(value?.toJSON) && require_convert_C8LsoKmI.isFunction(value?.toString) && [
|
|
114
112
|
"Instant",
|
|
115
113
|
"Duration",
|
|
116
114
|
"PlainDate",
|
|
@@ -125,7 +123,7 @@ function isDateLike(value) {
|
|
|
125
123
|
}
|
|
126
124
|
/** Checks if a value represents time value (number) with different forms of {@link TimeWithUnit units} */
|
|
127
125
|
function isTimeWithUnit(value) {
|
|
128
|
-
return
|
|
126
|
+
return require_convert_C8LsoKmI.isNonEmptyString(value) && /^-?\d*\.?\d+ *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.test(value);
|
|
129
127
|
}
|
|
130
128
|
|
|
131
129
|
//#endregion
|
package/dist/guards.d.cts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { En as Numeric, Nt as TimeZoneIdNative, Q as $TimeZoneIdentifier, at as ClockTime, ct as DateLike, kt as TimeWithUnit, zt as UTCOffset } from "./types-zhhEJ8N7.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 {
|
|
17
|
+
import { En as Numeric, Nt as TimeZoneIdNative, Q as $TimeZoneIdentifier, at as ClockTime, ct as DateLike, kt as TimeWithUnit, zt as UTCOffset } from "./types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/guards.d.ts
|
|
20
20
|
/**
|
package/dist/guards.mjs
CHANGED
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { n as NATIVE_TZ_IDS, t as IANA_TZ_IDS } from "./timezone-Db2CeL32.mjs";
|
|
18
|
-
import {
|
|
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";
|
|
18
|
+
import { c as isNumericString, i as normalizeNumber, l as isObject, m as isNonEmptyString, o as isFunction, p as isBoolean } from "./convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
21
19
|
|
|
22
20
|
//#region src/guards.ts
|
|
23
21
|
/**
|
|
@@ -15,12 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const require_basic = require('./basic-DsQqC5nZ.cjs');
|
|
18
|
-
const
|
|
19
|
-
const require_non_primitives = require('./non-primitives-BqjRwK2B.cjs');
|
|
20
|
-
const require_utilities = require('./utilities-C_KmjIRK.cjs');
|
|
18
|
+
const require_convert_C8LsoKmI = require('./convert-C8LsoKmI-uBhT5hZQ.cjs');
|
|
21
19
|
const require_guards = require('./guards.cjs');
|
|
22
20
|
|
|
23
|
-
//#region src/
|
|
21
|
+
//#region src/utilities/helpers.ts
|
|
24
22
|
/** Core formatting logic shared by `formatDate` and `Chronos`, `BanglaCalendar` classes */
|
|
25
23
|
function _formatDateCore(format, dateComponents) {
|
|
26
24
|
const tokenRegex = new RegExp(`^(${require_basic.SORTED_TIME_FORMATS.join("|")})`);
|
|
@@ -63,7 +61,7 @@ function _formatDate(format, year, month, day, date, hours, minutes, seconds, mi
|
|
|
63
61
|
ddd: require_basic.DAYS[day],
|
|
64
62
|
D: String(date),
|
|
65
63
|
DD: _padZero(date),
|
|
66
|
-
Do:
|
|
64
|
+
Do: require_convert_C8LsoKmI.getOrdinal(date),
|
|
67
65
|
H: String(hours),
|
|
68
66
|
HH: _padZero(hours),
|
|
69
67
|
h: String(hours % 12 || 12),
|
|
@@ -179,7 +177,7 @@ function _padShunno(str, length = 2) {
|
|
|
179
177
|
* @returns A `Date` object representing the input date.
|
|
180
178
|
*/
|
|
181
179
|
function _dateArgsToDate(value) {
|
|
182
|
-
return require_guards.isDate(value) ? value : new Date(
|
|
180
|
+
return require_guards.isDate(value) ? value : new Date(require_convert_C8LsoKmI.isString(value) ? value.replace(/['"]/g, "") : value ?? Date.now());
|
|
183
181
|
}
|
|
184
182
|
/**
|
|
185
183
|
* Type guard to check if a value has the necessary properties to be reconstructed into a `Chronos` instance.
|
|
@@ -188,13 +186,13 @@ function _dateArgsToDate(value) {
|
|
|
188
186
|
* @returns `true` if the value has the required properties for reconstruction, otherwise `false`.
|
|
189
187
|
*/
|
|
190
188
|
function _hasChronosProperties(value) {
|
|
191
|
-
return
|
|
189
|
+
return require_convert_C8LsoKmI.isObjectWithKeys(value, [
|
|
192
190
|
"origin",
|
|
193
191
|
"native",
|
|
194
192
|
"utcOffset",
|
|
195
193
|
"timeZoneName",
|
|
196
194
|
"timeZoneId"
|
|
197
|
-
]) &&
|
|
195
|
+
]) && require_convert_C8LsoKmI.isNonEmptyString(value.origin) && (require_guards.isDate(value.native) || require_guards.isDateString(value.native)) && require_guards.isValidUTCOffset(value.utcOffset) && require_convert_C8LsoKmI.isNonEmptyString(value.timeZoneName) && (require_convert_C8LsoKmI.isNonEmptyString(value.timeZoneId) || require_convert_C8LsoKmI.isValidArray(value.timeZoneId));
|
|
198
196
|
}
|
|
199
197
|
|
|
200
198
|
//#endregion
|
|
@@ -15,12 +15,10 @@
|
|
|
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 {
|
|
19
|
-
import { a as isValidArray, i as isObjectWithKeys } from "./non-primitives-CbAOB6lb.mjs";
|
|
20
|
-
import { t as getOrdinal } from "./utilities-BnHD2hHf.mjs";
|
|
18
|
+
import { d as isValidArray, g as isString, m as isNonEmptyString, r as getOrdinal, u as isObjectWithKeys } from "./convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
21
19
|
import { isDate, isDateString, isLeapYear, isValidUTCOffset } from "./guards.mjs";
|
|
22
20
|
|
|
23
|
-
//#region src/
|
|
21
|
+
//#region src/utilities/helpers.ts
|
|
24
22
|
/** Core formatting logic shared by `formatDate` and `Chronos`, `BanglaCalendar` classes */
|
|
25
23
|
function _formatDateCore(format, dateComponents) {
|
|
26
24
|
const tokenRegex = new RegExp(`^(${SORTED_TIME_FORMATS.join("|")})`);
|
package/dist/index.cjs
CHANGED
|
@@ -16,13 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_basic = require('./basic-DsQqC5nZ.cjs');
|
|
19
|
-
const
|
|
20
|
-
const require_non_primitives = require('./non-primitives-BqjRwK2B.cjs');
|
|
19
|
+
const require_convert_C8LsoKmI = require('./convert-C8LsoKmI-uBhT5hZQ.cjs');
|
|
21
20
|
const require_guards = require('./guards.cjs');
|
|
22
|
-
const require_helpers = require('./helpers-
|
|
23
|
-
const
|
|
21
|
+
const require_helpers = require('./helpers-BMDeRLjO.cjs');
|
|
22
|
+
const require_utils = require('./utils-S_aw0TeC.cjs');
|
|
24
23
|
|
|
25
|
-
//#region src/
|
|
24
|
+
//#region src/utilities/chronos-fn.ts
|
|
26
25
|
/**
|
|
27
26
|
* * Converts a date into a Chronos object and access to all `Chronos` methods and properties.
|
|
28
27
|
*
|
|
@@ -77,7 +76,7 @@ const require_utilities = require('./utilities-CCnKWAsS.cjs');
|
|
|
77
76
|
* ```
|
|
78
77
|
*/
|
|
79
78
|
const $chronos = (valueOrYear, month, date, hours, minutes, seconds, ms) => {
|
|
80
|
-
if (
|
|
79
|
+
if (require_convert_C8LsoKmI.isNumber(valueOrYear) && require_convert_C8LsoKmI.isNumber(month)) return new Chronos(valueOrYear, month, date ?? 1, hours ?? 0, minutes ?? 0, seconds ?? 0, ms ?? 0);
|
|
81
80
|
else return new Chronos(valueOrYear);
|
|
82
81
|
};
|
|
83
82
|
/**
|
|
@@ -87,7 +86,7 @@ const $chronos = (valueOrYear, month, date, hours, minutes, seconds, ms) => {
|
|
|
87
86
|
* @returns `true` if the property is a static method of `Chronos`, `false` otherwise.
|
|
88
87
|
*/
|
|
89
88
|
function _isChronosStaticKey(prop) {
|
|
90
|
-
return prop in Chronos && prop !== "prototype" && prop !== "name" && prop !== "length" &&
|
|
89
|
+
return prop in Chronos && prop !== "prototype" && prop !== "name" && prop !== "length" && require_convert_C8LsoKmI.isFunction(Chronos[prop]);
|
|
91
90
|
}
|
|
92
91
|
/**
|
|
93
92
|
* * Use `chronos` with all static methods from the `Chronos` class.
|
|
@@ -251,7 +250,7 @@ var Chronos = class Chronos {
|
|
|
251
250
|
* @returns Instance of `Chronos` with all methods and properties.
|
|
252
251
|
*/
|
|
253
252
|
constructor(valueOrYear, month, date, hours, minutes, seconds, ms) {
|
|
254
|
-
if (
|
|
253
|
+
if (require_convert_C8LsoKmI.isNumber(valueOrYear) && require_convert_C8LsoKmI.isNumber(month)) {
|
|
255
254
|
this.#date = new Date(valueOrYear, month - 1, date ?? 1, hours ?? 0, minutes ?? 0, seconds ?? 0, ms ?? 0);
|
|
256
255
|
this.native = this.#date;
|
|
257
256
|
} else {
|
|
@@ -318,7 +317,7 @@ var Chronos = class Chronos {
|
|
|
318
317
|
* @returns The resolved time zone name or its IANA identifier as a fallback.
|
|
319
318
|
*/
|
|
320
319
|
$getNativeTimeZoneName(tzId) {
|
|
321
|
-
const $tzId = tzId ||
|
|
320
|
+
const $tzId = tzId || require_utils.getNativeTimeZoneId();
|
|
322
321
|
return require_helpers._resolveNativeTzName($tzId, "long", this.#date) ?? $tzId;
|
|
323
322
|
}
|
|
324
323
|
/**
|
|
@@ -332,7 +331,7 @@ var Chronos = class Chronos {
|
|
|
332
331
|
* @returns The local system's IANA time zone identifier.
|
|
333
332
|
*/
|
|
334
333
|
$getNativeTimeZoneId() {
|
|
335
|
-
return
|
|
334
|
+
return require_utils.getNativeTimeZoneId();
|
|
336
335
|
}
|
|
337
336
|
/** Get timestamp (milliseconds since midnight, January 1, 1970 UTC) of the current instance, not the true `Date`. */
|
|
338
337
|
get #timestamp() {
|
|
@@ -477,7 +476,7 @@ var Chronos = class Chronos {
|
|
|
477
476
|
}
|
|
478
477
|
/** @instance Gets the native `Date` instance of the current `Chronos`. */
|
|
479
478
|
toDate() {
|
|
480
|
-
const adjustmentMs = (
|
|
479
|
+
const adjustmentMs = (require_utils.extractMinutesFromUTC(this.#offset) - this.getUTCOffsetMinutes()) * 6e4;
|
|
481
480
|
return new Date(this.#timestamp - adjustmentMs);
|
|
482
481
|
}
|
|
483
482
|
/** @instance Returns a string representation of a date. */
|
|
@@ -1074,7 +1073,7 @@ var Chronos = class Chronos {
|
|
|
1074
1073
|
* @returns The timezone offset in minutes maintaining the current timezone regardless of system having different one.
|
|
1075
1074
|
*/
|
|
1076
1075
|
getTimeZoneOffsetMinutes() {
|
|
1077
|
-
return
|
|
1076
|
+
return require_utils.extractMinutesFromUTC(this.#offset);
|
|
1078
1077
|
}
|
|
1079
1078
|
/** @instance Returns new `Chronos` instance in UTC time */
|
|
1080
1079
|
toUTC() {
|
|
@@ -1372,7 +1371,7 @@ var Chronos = class Chronos {
|
|
|
1372
1371
|
*/
|
|
1373
1372
|
static isLeapYear(date) {
|
|
1374
1373
|
let year;
|
|
1375
|
-
if (
|
|
1374
|
+
if (require_convert_C8LsoKmI.isNumber(date)) if (date > 0 && date <= 9999) year = date;
|
|
1376
1375
|
else year = new Date(date).getFullYear();
|
|
1377
1376
|
else year = Chronos.#cast(date).year;
|
|
1378
1377
|
return require_guards.isLeapYear(year);
|
|
@@ -1427,7 +1426,7 @@ var Chronos = class Chronos {
|
|
|
1427
1426
|
static reconstruct(value) {
|
|
1428
1427
|
if (!require_helpers._hasChronosProperties(value)) throw new TypeError("Invalid input for reconstruction!");
|
|
1429
1428
|
const { native, origin, utcOffset, timeZoneName, timeZoneId, $tzTracker } = value;
|
|
1430
|
-
const offsetMins =
|
|
1429
|
+
const offsetMins = require_utils.extractMinutesFromUTC(utcOffset);
|
|
1431
1430
|
const chr = new Chronos(native);
|
|
1432
1431
|
const diffMins = chr.getTimeZoneOffsetMinutes() - offsetMins;
|
|
1433
1432
|
return (chr.utcOffset === utcOffset ? chr : chr.add(-diffMins, "minute")).#withOrigin(origin, utcOffset, timeZoneName, timeZoneId, $tzTracker);
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { D as INTERNALS } from "./seasons-
|
|
18
|
-
import { Ht as chronos, Vt as Chronos } from "./types-
|
|
17
|
+
import { D as INTERNALS } from "./seasons-DYk2jvtn.mjs";
|
|
18
|
+
import { Ht as chronos, Vt as Chronos } from "./types-CiFnGEL8.mjs";
|
|
19
19
|
export { Chronos, INTERNALS, chronos };
|
package/dist/index.mjs
CHANGED
|
@@ -15,13 +15,12 @@
|
|
|
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 {
|
|
19
|
-
import { t as isFunction } from "./non-primitives-CbAOB6lb.mjs";
|
|
18
|
+
import { h as isNumber, o as isFunction } from "./convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
20
19
|
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 "./
|
|
20
|
+
import { c as _hasChronosProperties, n as _dateArgsToDate, p as _resolveNativeTzName, r as _formatDate, u as _normalizeOffset } from "./helpers-t49KkxOE.mjs";
|
|
21
|
+
import { l as getNativeTimeZoneId, r as extractMinutesFromUTC } from "./utils-DBy7S7hH.mjs";
|
|
23
22
|
|
|
24
|
-
//#region src/
|
|
23
|
+
//#region src/utilities/chronos-fn.ts
|
|
25
24
|
/**
|
|
26
25
|
* * Converts a date into a Chronos object and access to all `Chronos` methods and properties.
|
|
27
26
|
*
|
|
@@ -16,26 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_basic = require('../basic-DsQqC5nZ.cjs');
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const require_helpers = require('../helpers-Bq7Hczoa.cjs');
|
|
19
|
+
const require_dist = require('../dist-CdMlZMZa.cjs');
|
|
20
|
+
const require_helpers = require('../helpers-BMDeRLjO.cjs');
|
|
22
21
|
|
|
23
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/number/convert.js
|
|
24
|
-
function digitToBangla(digit, preserveNonDigit = true) {
|
|
25
|
-
const banglaDigits = Object.keys(require_utilities.BN_DIGITS);
|
|
26
|
-
const _matchAndConvert = (value) => {
|
|
27
|
-
return value.replace(/\d/g, (dig) => banglaDigits[Number(dig)]);
|
|
28
|
-
};
|
|
29
|
-
if (require_primitives.isNumber(digit)) return _matchAndConvert(String(digit));
|
|
30
|
-
if (require_primitives.isNonEmptyString(digit)) {
|
|
31
|
-
const bnDigStr = _matchAndConvert(digit);
|
|
32
|
-
if (preserveNonDigit || require_utilities.isNumericString(digit)) return bnDigStr;
|
|
33
|
-
return bnDigStr.split("").filter((dig) => banglaDigits.includes(dig)).join("");
|
|
34
|
-
}
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
22
|
//#region src/plugins/banglaPlugin.ts
|
|
40
23
|
/** * Plugin to inject methods related to Bangla calendar system (`Bongabdo`) */
|
|
41
24
|
const banglaPlugin = ($Chronos) => {
|
|
@@ -49,17 +32,17 @@ const banglaPlugin = ($Chronos) => {
|
|
|
49
32
|
};
|
|
50
33
|
$Chronos.prototype.getBanglaYear = function(locale = "bn") {
|
|
51
34
|
const bnYear = require_helpers._getBnYear($Date(this));
|
|
52
|
-
return locale === "en" ? bnYear : digitToBangla(bnYear);
|
|
35
|
+
return locale === "en" ? bnYear : require_dist.digitToBangla(bnYear);
|
|
53
36
|
};
|
|
54
37
|
$Chronos.prototype.getBanglaMonth = function(options) {
|
|
55
38
|
const { locale = "bn", variant } = options ?? {};
|
|
56
39
|
const isoMonth = $bnDaysMonthIdx($Date(this), variant).monthIdx + 1;
|
|
57
|
-
return locale === "en" ? isoMonth : digitToBangla(isoMonth);
|
|
40
|
+
return locale === "en" ? isoMonth : require_dist.digitToBangla(isoMonth);
|
|
58
41
|
};
|
|
59
42
|
$Chronos.prototype.getBanglaDay = function(options) {
|
|
60
43
|
const { locale = "bn", variant } = options ?? {};
|
|
61
44
|
const date = $bnDaysMonthIdx($Date(this), variant).days + 1;
|
|
62
|
-
return locale === "en" ? date : digitToBangla(date);
|
|
45
|
+
return locale === "en" ? date : require_dist.digitToBangla(date);
|
|
63
46
|
};
|
|
64
47
|
$Chronos.prototype.getBanglaDayName = function(locale = "bn") {
|
|
65
48
|
const DAY = require_basic.BN_DAYS[this.weekDay];
|
|
@@ -97,7 +80,7 @@ const banglaPlugin = ($Chronos) => {
|
|
|
97
80
|
const year = require_helpers._padShunno(this.getBanglaYear(), 4);
|
|
98
81
|
const date = this.getBanglaDay({ variant });
|
|
99
82
|
const seasonName = this.getBanglaSeasonName({ variant });
|
|
100
|
-
const offset = digitToBangla(this.getTimeZoneOffset());
|
|
83
|
+
const offset = require_dist.digitToBangla(this.getTimeZoneOffset());
|
|
101
84
|
const dateComponents = {
|
|
102
85
|
YYYY: year,
|
|
103
86
|
YY: year.slice(-2),
|
|
@@ -113,16 +96,16 @@ const banglaPlugin = ($Chronos) => {
|
|
|
113
96
|
D: date,
|
|
114
97
|
DD: require_helpers._padShunno(date),
|
|
115
98
|
Do: date,
|
|
116
|
-
H: digitToBangla(hour),
|
|
117
|
-
HH: require_helpers._padShunno(digitToBangla(hour)),
|
|
118
|
-
h: digitToBangla(hour % 12 || 12),
|
|
119
|
-
hh: require_helpers._padShunno(digitToBangla(hour % 12 || 12)),
|
|
120
|
-
m: digitToBangla(minute),
|
|
121
|
-
mm: require_helpers._padShunno(digitToBangla(minute)),
|
|
122
|
-
s: digitToBangla(second),
|
|
123
|
-
ss: require_helpers._padShunno(digitToBangla(second)),
|
|
124
|
-
ms: digitToBangla(millisecond),
|
|
125
|
-
mss: require_helpers._padShunno(digitToBangla(millisecond), 3),
|
|
99
|
+
H: require_dist.digitToBangla(hour),
|
|
100
|
+
HH: require_helpers._padShunno(require_dist.digitToBangla(hour)),
|
|
101
|
+
h: require_dist.digitToBangla(hour % 12 || 12),
|
|
102
|
+
hh: require_helpers._padShunno(require_dist.digitToBangla(hour % 12 || 12)),
|
|
103
|
+
m: require_dist.digitToBangla(minute),
|
|
104
|
+
mm: require_helpers._padShunno(require_dist.digitToBangla(minute)),
|
|
105
|
+
s: require_dist.digitToBangla(second),
|
|
106
|
+
ss: require_helpers._padShunno(require_dist.digitToBangla(second)),
|
|
107
|
+
ms: require_dist.digitToBangla(millisecond),
|
|
108
|
+
mss: require_helpers._padShunno(require_dist.digitToBangla(millisecond), 3),
|
|
126
109
|
a: hour < 12 ? "পূর্বাহ্ণ" : "অপরাহ্ণ",
|
|
127
110
|
A: hour < 12 ? "পূর্বাহ্ণ" : "অপরাহ্ণ",
|
|
128
111
|
Z: offset,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { $t as BanglaDateOptions, Gt as $BanglaYear, Qt as BanglaDateObject, Ut as $BanglaMonth, Wt as $BanglaMonthDate, an as BnCalendarConfig, en as BanglaDayName, gn as SafeFormat, nn as BanglaMonthName,
|
|
17
|
+
import { $t as BanglaDateOptions, Gt as $BanglaYear, Qt as BanglaDateObject, Ut as $BanglaMonth, Wt as $BanglaMonthDate, an as BnCalendarConfig, en as BanglaDayName, gn as SafeFormat, nn as BanglaMonthName, qt as $BnEn, rn as BanglaSeasonName, s as ChronosPlugin } from "../types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/banglaPlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { $t as BanglaDateOptions, Gt as $BanglaYear, Qt as BanglaDateObject, Ut as $BanglaMonth, Wt as $BanglaMonthDate, an as BnCalendarConfig, en as BanglaDayName, gn as SafeFormat, nn as BanglaMonthName,
|
|
17
|
+
import { $t as BanglaDateOptions, Gt as $BanglaYear, Qt as BanglaDateObject, Ut as $BanglaMonth, Wt as $BanglaMonthDate, an as BnCalendarConfig, en as BanglaDayName, gn as SafeFormat, nn as BanglaMonthName, qt as $BnEn, rn as BanglaSeasonName, s as ChronosPlugin } from "../types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/banglaPlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -15,26 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { n as BN_MONTHS, s as INTERNALS, t as BN_DAYS } from "../basic-DqKyujoj.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { a as
|
|
20
|
-
import { a as _getBnSeason, d as _padShunno, i as _formatDateCore, l as _isBnLeapYear, o as _getBnYear, t as _bnDaysMonthIdx } from "../helpers-C2spzGZ-.mjs";
|
|
18
|
+
import { t as digitToBangla } from "../dist-BPHYJA0t.mjs";
|
|
19
|
+
import { a as _getBnSeason, d as _padShunno, i as _formatDateCore, l as _isBnLeapYear, o as _getBnYear, t as _bnDaysMonthIdx } from "../helpers-t49KkxOE.mjs";
|
|
21
20
|
|
|
22
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/number/convert.js
|
|
23
|
-
function digitToBangla(digit, preserveNonDigit = true) {
|
|
24
|
-
const banglaDigits = Object.keys(BN_DIGITS);
|
|
25
|
-
const _matchAndConvert = (value) => {
|
|
26
|
-
return value.replace(/\d/g, (dig) => banglaDigits[Number(dig)]);
|
|
27
|
-
};
|
|
28
|
-
if (isNumber(digit)) return _matchAndConvert(String(digit));
|
|
29
|
-
if (isNonEmptyString(digit)) {
|
|
30
|
-
const bnDigStr = _matchAndConvert(digit);
|
|
31
|
-
if (preserveNonDigit || isNumericString(digit)) return bnDigStr;
|
|
32
|
-
return bnDigStr.split("").filter((dig) => banglaDigits.includes(dig)).join("");
|
|
33
|
-
}
|
|
34
|
-
return "";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
21
|
//#region src/plugins/banglaPlugin.ts
|
|
39
22
|
/** * Plugin to inject methods related to Bangla calendar system (`Bongabdo`) */
|
|
40
23
|
const banglaPlugin = ($Chronos) => {
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_basic = require('../basic-DsQqC5nZ.cjs');
|
|
19
|
-
const
|
|
20
|
-
const require_non_primitives = require('../non-primitives-BqjRwK2B.cjs');
|
|
19
|
+
const require_convert_C8LsoKmI = require('../convert-C8LsoKmI-uBhT5hZQ.cjs');
|
|
21
20
|
|
|
22
21
|
//#region src/plugins/businessPlugin.ts
|
|
23
22
|
/** * Plugin to inject `business` related methods */
|
|
@@ -25,7 +24,7 @@ const businessPlugin = ($Chronos) => {
|
|
|
25
24
|
const { internalDate: $Date, withOrigin, cast, offset } = $Chronos[require_basic.INTERNALS];
|
|
26
25
|
/** Build weekend mask (array of booleans) based on `week definition` or weekend `length` */
|
|
27
26
|
const _buildWeekendMask = (weekDef, length) => {
|
|
28
|
-
const weekendDays =
|
|
27
|
+
const weekendDays = require_convert_C8LsoKmI.isValidArray(weekDef) ? [...weekDef].sort() : Array.from({ length }, (_, i) => (weekDef + 7 - 1 - i) % 7).sort();
|
|
29
28
|
const mask = new Array(7).fill(true);
|
|
30
29
|
for (const d of weekendDays) mask[d] = false;
|
|
31
30
|
return mask;
|
|
@@ -42,7 +41,7 @@ const businessPlugin = ($Chronos) => {
|
|
|
42
41
|
};
|
|
43
42
|
$Chronos.prototype.isWeekend = function(wDef = 0, wLen = 2) {
|
|
44
43
|
const day = $Date(this).getDay();
|
|
45
|
-
if (
|
|
44
|
+
if (require_convert_C8LsoKmI.isValidArray(wDef)) return wDef.includes(day);
|
|
46
45
|
const lastDayOfWeek = (wDef + 6) % 7;
|
|
47
46
|
return Array.from({ length: wLen }, (_, i) => (lastDayOfWeek - i + 7) % 7).includes(day);
|
|
48
47
|
};
|
|
@@ -115,7 +114,7 @@ const businessPlugin = ($Chronos) => {
|
|
|
115
114
|
if (businessStartHour < businessEndHour) return hour >= businessStartHour && hour < businessEndHour;
|
|
116
115
|
else return hour >= businessStartHour || hour < businessEndHour;
|
|
117
116
|
};
|
|
118
|
-
if (options && "weekendDays" in options && !
|
|
117
|
+
if (options && "weekendDays" in options && !require_convert_C8LsoKmI.isUndefined(options?.weekendDays)) return this.isWorkday(options.weekendDays) && _isBusinessHour();
|
|
119
118
|
const { weekStartsOn = 0, weekendLength = 2 } = options ?? {};
|
|
120
119
|
return this.isWorkday(weekStartsOn, weekendLength) && _isBusinessHour();
|
|
121
120
|
};
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { Dn as RangeTuple, Et as Quarter, O as ChronosInput, Sn as Enumerate, Tn as NumberRange, a as BusinessOptionsBasic, i as AcademicYear, o as BusinessOptionsWeekends, s as ChronosPlugin } from "../types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/businessPlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { Dn as RangeTuple, Et as Quarter, O as ChronosInput, Sn as Enumerate, Tn as NumberRange, a as BusinessOptionsBasic, i as AcademicYear, o as BusinessOptionsWeekends, s as ChronosPlugin } from "../types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/businessPlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { s as INTERNALS } from "../basic-DqKyujoj.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { a as isValidArray } from "../non-primitives-CbAOB6lb.mjs";
|
|
18
|
+
import { _ as isUndefined, d as isValidArray } from "../convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
20
19
|
|
|
21
20
|
//#region src/plugins/businessPlugin.ts
|
|
22
21
|
/** * Plugin to inject `business` related methods */
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_basic = require('../basic-DsQqC5nZ.cjs');
|
|
19
|
-
const
|
|
20
|
-
const require_non_primitives = require('../non-primitives-BqjRwK2B.cjs');
|
|
19
|
+
const require_convert_C8LsoKmI = require('../convert-C8LsoKmI-uBhT5hZQ.cjs');
|
|
21
20
|
|
|
22
21
|
//#region src/plugins/dateRangePlugin.ts
|
|
23
22
|
/** * Plugin to inject `getDatesInRange` related method */
|
|
@@ -39,8 +38,8 @@ const dateRangePlugin = ($Chronos) => {
|
|
|
39
38
|
startDate = startDate.startOf("day");
|
|
40
39
|
endDate = endDate.startOf("day");
|
|
41
40
|
}
|
|
42
|
-
const skippedDays =
|
|
43
|
-
const skipSet = new Set(skippedDays.map((day) =>
|
|
41
|
+
const skippedDays = require_convert_C8LsoKmI.isValidArray(onlyDays) ? onlyDays : require_convert_C8LsoKmI.isValidArray(skipDays) ? skipDays : [];
|
|
42
|
+
const skipSet = new Set(skippedDays.map((day) => require_convert_C8LsoKmI.isNumber(day) ? day : require_basic.DAYS.indexOf(day)));
|
|
44
43
|
const dates = [];
|
|
45
44
|
const startTime = $Date(startDate).getTime();
|
|
46
45
|
const endTime = $Date(endDate).getTime();
|
|
@@ -49,7 +48,7 @@ const dateRangePlugin = ($Chronos) => {
|
|
|
49
48
|
for (let i = 0; i <= totalDays; i++) {
|
|
50
49
|
const ts = startTime + i * step;
|
|
51
50
|
const wDay = new Date(ts).getDay();
|
|
52
|
-
if (
|
|
51
|
+
if (require_convert_C8LsoKmI.isValidArray(onlyDays) ? skipSet.has(wDay) : !skipSet.has(wDay)) {
|
|
53
52
|
const chr = withOrigin(new $Chronos(ts), "clone", offset(this), startDate.timeZoneName, startDate.timeZoneId, startDate.$tzTracker);
|
|
54
53
|
dates.push(format === "local" ? chr.toLocalISOString() : chr.toISOString());
|
|
55
54
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { R as RangeWithDates, gt as ISODateTimeString, s as ChronosPlugin, z as RelativeDateRange } from "../types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/dateRangePlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { R as RangeWithDates, gt as ISODateTimeString, s as ChronosPlugin, z as RelativeDateRange } from "../types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/dateRangePlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { o as DAYS, s as INTERNALS, u as MS_PER_DAY } from "../basic-DqKyujoj.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { a as isValidArray } from "../non-primitives-CbAOB6lb.mjs";
|
|
18
|
+
import { d as isValidArray, h as isNumber } from "../convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
20
19
|
|
|
21
20
|
//#region src/plugins/dateRangePlugin.ts
|
|
22
21
|
/** * Plugin to inject `getDatesInRange` related method */
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_basic = require('../basic-DsQqC5nZ.cjs');
|
|
19
|
-
const
|
|
19
|
+
const require_convert_C8LsoKmI = require('../convert-C8LsoKmI-uBhT5hZQ.cjs');
|
|
20
20
|
|
|
21
21
|
//#region src/plugins/dayPartPlugin.ts
|
|
22
22
|
/** * Plugin to inject `getPartOfDay` method */
|
|
@@ -25,7 +25,7 @@ const dayPartPlugin = ($Chronos) => {
|
|
|
25
25
|
const hour = this.hour;
|
|
26
26
|
const ranges = {
|
|
27
27
|
...require_basic.DATE_PART_RANGES,
|
|
28
|
-
...
|
|
28
|
+
...require_convert_C8LsoKmI.isNotEmptyObject(config) && config
|
|
29
29
|
};
|
|
30
30
|
for (const [part, [start, end]] of Object.entries(ranges)) {
|
|
31
31
|
const from = Number(start);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { l as DayPart, s as ChronosPlugin, u as DayPartConfig } from "../types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/dayPartPlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|