chronos-date 2.0.4 → 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/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
|
@@ -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' {
|
|
@@ -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-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/dayPartPlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { a as DATE_PART_RANGES } from "../basic-DqKyujoj.mjs";
|
|
18
|
-
import {
|
|
18
|
+
import { s as isNotEmptyObject } from "../convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/plugins/dayPartPlugin.ts
|
|
21
21
|
/** * Plugin to inject `getPartOfDay` method */
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { O as ChronosInput, _ as TimeDuration, f as DurationOptions, s as ChronosPlugin } from "../types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/durationPlugin.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 { O as ChronosInput, _ as TimeDuration, f as DurationOptions, s as ChronosPlugin } from "../types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/durationPlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -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/fromNowPlugin.ts
|
|
22
22
|
/** * Plugin to inject `fromNow` method */
|
|
@@ -71,7 +71,7 @@ const fromNowPlugin = ($Chronos) => {
|
|
|
71
71
|
const parts = [];
|
|
72
72
|
/** Push value-unit string to `parts` array */
|
|
73
73
|
const _pushToParts = (value, unit) => {
|
|
74
|
-
parts.push(
|
|
74
|
+
parts.push(require_convert_C8LsoKmI.formatUnitWithPlural(value, unit));
|
|
75
75
|
};
|
|
76
76
|
/** Check if a unit level is required */
|
|
77
77
|
const _isLevelRequired = (unit) => {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { O as ChronosInput, ft as FromNowUnit, s as ChronosPlugin } from "../types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/fromNowPlugin.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 { O as ChronosInput, ft as FromNowUnit, s as ChronosPlugin } from "../types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/fromNowPlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { s as INTERNALS } from "../basic-DqKyujoj.mjs";
|
|
18
|
-
import { t as formatUnitWithPlural } from "../convert-
|
|
18
|
+
import { t as formatUnitWithPlural } from "../convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/plugins/fromNowPlugin.ts
|
|
21
21
|
/** * Plugin to inject `fromNow` method */
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
|
-
const require_greet = require('../greet-
|
|
18
|
+
const require_greet = require('../greet-Brz0CVv1.cjs');
|
|
19
19
|
|
|
20
20
|
//#region src/plugins/greetingPlugin.ts
|
|
21
21
|
/** * Plugin to inject `getGreeting`/`greet` method */
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { pt as GreetingConfigs, s as ChronosPlugin } from "../types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/greetingPlugin.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 { pt as GreetingConfigs, s as ChronosPlugin } from "../types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/greetingPlugin.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 getGreeting } from "../greet-
|
|
17
|
+
import { t as getGreeting } from "../greet-BC86-X9W.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/greetingPlugin.ts
|
|
20
20
|
/** * Plugin to inject `getGreeting`/`greet` method */
|
|
@@ -15,22 +15,15 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
|
-
const
|
|
18
|
+
const require_guards = require('../guards-dH9JJIso.cjs');
|
|
19
19
|
|
|
20
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/string/guards.js
|
|
21
|
-
const isPalindrome = (input) => {
|
|
22
|
-
const normalized = input.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
23
|
-
return normalized === require_convert.reverseString(normalized);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
20
|
//#region src/plugins/palindromePlugin.ts
|
|
28
21
|
/** * Plugin to inject `isPalindromeDate` method */
|
|
29
22
|
const palindromePlugin = ($Chronos) => {
|
|
30
23
|
$Chronos.prototype.isPalindromeDate = function(shortYear = false) {
|
|
31
24
|
const padded = this.formatSafe(shortYear ? "YY-MM-DD" : "YYYY-MM-DD");
|
|
32
25
|
const normal = this.formatSafe(shortYear ? "YY-M-D" : "YYYY-M-D");
|
|
33
|
-
return isPalindrome(padded) || isPalindrome(normal);
|
|
26
|
+
return require_guards.isPalindrome(padded) || require_guards.isPalindrome(normal);
|
|
34
27
|
};
|
|
35
28
|
};
|
|
36
29
|
|
|
@@ -14,15 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { t as isPalindrome } from "../guards-DTI799nG.mjs";
|
|
18
18
|
|
|
19
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/string/guards.js
|
|
20
|
-
const isPalindrome = (input) => {
|
|
21
|
-
const normalized = input.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
22
|
-
return normalized === reverseString(normalized);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
19
|
//#region src/plugins/palindromePlugin.ts
|
|
27
20
|
/** * Plugin to inject `isPalindromeDate` method */
|
|
28
21
|
const palindromePlugin = ($Chronos) => {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { Dt as TimeUnit, O as ChronosInput, s as ChronosPlugin } from "../types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/relativeTimePlugin.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 { Dt as TimeUnit, O as ChronosInput, s as ChronosPlugin } from "../types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/relativeTimePlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -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/roundPlugin.ts
|
|
22
22
|
/** * Plugin to inject `round` method */
|
|
@@ -26,27 +26,27 @@ const roundPlugin = ($Chronos) => {
|
|
|
26
26
|
const date = new Date(internalDate(this));
|
|
27
27
|
switch (unit) {
|
|
28
28
|
case "millisecond": {
|
|
29
|
-
const rounded =
|
|
29
|
+
const rounded = require_convert_C8LsoKmI.roundToNearest(date.getMilliseconds(), nearest);
|
|
30
30
|
date.setMilliseconds(rounded);
|
|
31
31
|
break;
|
|
32
32
|
}
|
|
33
33
|
case "second": {
|
|
34
|
-
const rounded =
|
|
34
|
+
const rounded = require_convert_C8LsoKmI.roundToNearest(date.getSeconds() + date.getMilliseconds() / 1e3, nearest);
|
|
35
35
|
date.setSeconds(rounded, 0);
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
38
|
case "minute": {
|
|
39
|
-
const rounded =
|
|
39
|
+
const rounded = require_convert_C8LsoKmI.roundToNearest(date.getMinutes() + date.getSeconds() / 60 + date.getMilliseconds() / 6e4, nearest);
|
|
40
40
|
date.setMinutes(rounded, 0, 0);
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
case "hour": {
|
|
44
|
-
const rounded =
|
|
44
|
+
const rounded = require_convert_C8LsoKmI.roundToNearest(date.getHours() + date.getMinutes() / 60 + date.getSeconds() / 3600 + date.getMilliseconds() / 36e5, nearest);
|
|
45
45
|
date.setHours(rounded, 0, 0, 0);
|
|
46
46
|
break;
|
|
47
47
|
}
|
|
48
48
|
case "day": {
|
|
49
|
-
const rounded =
|
|
49
|
+
const rounded = require_convert_C8LsoKmI.roundToNearest(date.getDate() + (date.getHours() / 24 + date.getMinutes() / 1440 + date.getSeconds() / 86400 + date.getMilliseconds() / require_basic.MS_PER_DAY), nearest);
|
|
50
50
|
date.setDate(rounded);
|
|
51
51
|
date.setHours(0, 0, 0, 0);
|
|
52
52
|
break;
|
|
@@ -62,7 +62,7 @@ const roundPlugin = ($Chronos) => {
|
|
|
62
62
|
return withOrigin(new $Chronos(Math.abs(endOfWeek.getTime() - date.getTime()) < diffToStart ? endOfWeek : startOfWeek), "round", offset(this), this.timeZoneName, this.timeZoneId, this.$tzTracker);
|
|
63
63
|
}
|
|
64
64
|
case "month": {
|
|
65
|
-
const roundedMonth =
|
|
65
|
+
const roundedMonth = require_convert_C8LsoKmI.roundToNearest(date.getMonth() + date.getDate() / this.lastDateOfMonth, nearest);
|
|
66
66
|
date.setMonth(roundedMonth, 1);
|
|
67
67
|
date.setHours(0, 0, 0, 0);
|
|
68
68
|
break;
|
|
@@ -70,7 +70,7 @@ const roundPlugin = ($Chronos) => {
|
|
|
70
70
|
case "year": {
|
|
71
71
|
const dayOfYear = Math.floor((date.getTime() - new Date(date.getFullYear(), 0, 1).getTime()) / require_basic.MS_PER_DAY);
|
|
72
72
|
const totalDays = new Date(date.getFullYear(), 1, 29).getDate() === 29 ? 366 : 365;
|
|
73
|
-
const roundedYear =
|
|
73
|
+
const roundedYear = require_convert_C8LsoKmI.roundToNearest(date.getFullYear() + dayOfYear / totalDays, nearest);
|
|
74
74
|
date.setFullYear(roundedYear, 0, 1);
|
|
75
75
|
date.setHours(0, 0, 0, 0);
|
|
76
76
|
break;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { Dt as TimeUnit, s as ChronosPlugin } from "../types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/roundPlugin.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 { Dt as TimeUnit, s as ChronosPlugin } from "../types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/roundPlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { s as INTERNALS, u as MS_PER_DAY } from "../basic-DqKyujoj.mjs";
|
|
18
|
-
import {
|
|
18
|
+
import { a as roundToNearest } from "../convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/plugins/roundPlugin.ts
|
|
21
21
|
/** * Plugin to inject `round` method */
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { h as SeasonOptions, s as ChronosPlugin } from "../types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/seasonPlugin.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 { h as SeasonOptions, s as ChronosPlugin } from "../types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/plugins/seasonPlugin.d.ts
|
|
20
20
|
declare module 'chronos-date' {
|