@uxf/datepicker 16.15.0 → 16.16.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/contexts/date-picker-context.d.ts +1 -1
- package/contexts/date-picker-context.js +2 -2
- package/contexts/date-range-picker-context.d.ts +1 -1
- package/contexts/date-range-picker-context.js +2 -2
- package/contexts/time-picker-context.js +2 -2
- package/hooks/use-date-picker-navigation.d.ts +2 -2
- package/hooks/use-date-picker-navigation.js +22 -22
- package/hooks/use-date-picker-navigation.test.js +7 -7
- package/hooks/use-date-picker.d.ts +2 -2
- package/hooks/use-date-picker.js +32 -32
- package/hooks/use-date-picker.test.js +7 -7
- package/hooks/use-date-range-picker.d.ts +2 -2
- package/hooks/use-date-range-picker.js +62 -62
- package/hooks/use-date-range-picker.test.js +16 -16
- package/hooks/use-day.d.ts +1 -1
- package/hooks/use-day.js +22 -22
- package/hooks/use-day.test.js +12 -12
- package/hooks/use-decade.d.ts +1 -1
- package/hooks/use-decade.js +8 -8
- package/hooks/use-decade.test.js +6 -6
- package/hooks/use-hour.test.js +3 -3
- package/hooks/use-hours.test.js +3 -3
- package/hooks/use-minute.test.js +3 -3
- package/hooks/use-minutes.test.js +3 -3
- package/hooks/use-month.d.ts +2 -2
- package/hooks/use-month.js +10 -10
- package/hooks/use-month.test.js +7 -7
- package/hooks/use-time-picker.test.js +5 -5
- package/hooks/use-year.d.ts +1 -1
- package/hooks/use-year.js +7 -7
- package/hooks/use-year.test.js +6 -6
- package/package.json +5 -5
- package/utils/can-select-range.d.ts +1 -1
- package/utils/can-select-range.js +8 -8
- package/utils/can-select-range.test.js +10 -10
- package/utils/date-string.d.ts +1 -1
- package/utils/date-string.js +6 -6
- package/utils/date-string.test.js +33 -33
- package/utils/dayjs-utils.d.ts +1 -1
- package/utils/dayjs-utils.js +8 -41
- package/utils/dst-robustness.test.js +74 -74
- package/utils/get-current-year-month-and-date.d.ts +1 -1
- package/utils/get-current-year-month-and-date.js +2 -2
- package/utils/get-current-year-month-and-date.test.js +3 -3
- package/utils/get-date-intervals.test.js +15 -15
- package/utils/get-date-invervals.js +4 -4
- package/utils/get-date-month-and-year.d.ts +1 -1
- package/utils/get-date-month-and-year.js +4 -4
- package/utils/get-date-month-and-year.test.js +3 -3
- package/utils/get-days.d.ts +1 -1
- package/utils/get-days.js +17 -17
- package/utils/get-days.test.js +5 -5
- package/utils/get-each.d.ts +1 -1
- package/utils/get-each.js +5 -5
- package/utils/get-each.test.js +11 -11
- package/utils/get-first-active-month.d.ts +1 -1
- package/utils/get-first-active-month.js +2 -2
- package/utils/get-first-active-month.test.js +5 -5
- package/utils/get-initial-months.d.ts +1 -1
- package/utils/get-initial-months.js +6 -6
- package/utils/get-initial-months.test.js +5 -5
- package/utils/get-months.js +9 -9
- package/utils/get-months.test.js +4 -4
- package/utils/get-next-active-month.d.ts +1 -1
- package/utils/get-next-active-month.js +6 -6
- package/utils/get-next-active-month.test.js +9 -9
- package/utils/get-weekday-labels.d.ts +1 -1
- package/utils/get-weekday-labels.js +6 -6
- package/utils/get-weekday-labels.test.d.ts +1 -1
- package/utils/get-weekday-labels.test.js +8 -8
- package/utils/get-years.js +6 -6
- package/utils/get-years.test.js +5 -5
- package/utils/is-date-blocked.d.ts +1 -1
- package/utils/is-date-blocked.js +5 -5
- package/utils/is-date-blocked.test.js +16 -16
- package/utils/is-date-hovered.d.ts +1 -1
- package/utils/is-date-hovered.js +7 -7
- package/utils/is-date-hovered.test.js +9 -9
- package/utils/is-date-inside-range.d.ts +1 -1
- package/utils/is-date-selected.test.js +13 -13
- package/utils/is-end-date.d.ts +1 -1
- package/utils/is-end-date.test.js +10 -10
- package/utils/is-first-or-last-selected-date.d.ts +1 -1
- package/utils/is-first-or-last-selected-date.test.js +10 -10
- package/utils/is-in-unavailable-dates.d.ts +1 -1
- package/utils/is-in-unavailable-dates.test.js +9 -9
- package/utils/is-start-date.d.ts +1 -1
- package/utils/is-start-date.test.js +10 -10
package/utils/date-string.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.fromDateString = fromDateString;
|
|
|
5
5
|
exports.todayDateString = todayDateString;
|
|
6
6
|
exports.addMonths = addMonths;
|
|
7
7
|
exports.addDays = addDays;
|
|
8
|
-
const
|
|
8
|
+
const create_date_string_ts_1 = require("./create-date-string.js");
|
|
9
9
|
const DAY_MS = 86400000;
|
|
10
10
|
/**
|
|
11
11
|
* Convert a Date to a zero-padded DateString.
|
|
@@ -23,10 +23,10 @@ function toDateString(date) {
|
|
|
23
23
|
date.getUTCMinutes() === 0 &&
|
|
24
24
|
date.getUTCSeconds() === 0 &&
|
|
25
25
|
date.getUTCMilliseconds() === 0) {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, create_date_string_ts_1.createDateString)(date.getUTCFullYear(), date.getUTCMonth(), // 0-indexed; createDateString adds 1
|
|
27
27
|
date.getUTCDate());
|
|
28
28
|
}
|
|
29
|
-
return (0,
|
|
29
|
+
return (0, create_date_string_ts_1.createDateString)(date.getFullYear(), date.getMonth(), // 0-indexed; createDateString adds 1
|
|
30
30
|
date.getDate());
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
@@ -37,7 +37,7 @@ function fromDateString(s) {
|
|
|
37
37
|
}
|
|
38
38
|
function deviceDateString(now) {
|
|
39
39
|
const date = new Date(now);
|
|
40
|
-
return (0,
|
|
40
|
+
return (0, create_date_string_ts_1.createDateString)(date.getFullYear(), date.getMonth(), date.getDate());
|
|
41
41
|
}
|
|
42
42
|
// every day cell asks for today, so each zone gets one formatter; null marks an unknown zone
|
|
43
43
|
const formatters = new Map();
|
|
@@ -73,7 +73,7 @@ function todayDateString(now = Date.now(), timeZone) {
|
|
|
73
73
|
return deviceDateString(now);
|
|
74
74
|
}
|
|
75
75
|
const parts = Object.fromEntries(formatter.formatToParts(now).map((part) => [part.type, Number(part.value)]));
|
|
76
|
-
return (0,
|
|
76
|
+
return (0, create_date_string_ts_1.createDateString)(parts.year, parts.month - 1, parts.day);
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Add n calendar months to a DateString, snapping to the 1st of the resulting month.
|
|
@@ -83,7 +83,7 @@ function addMonths(date, n) {
|
|
|
83
83
|
const y = parseInt(date.slice(0, 4), 10);
|
|
84
84
|
const m = parseInt(date.slice(5, 7), 10) - 1; // 0-indexed
|
|
85
85
|
const total = y * 12 + m + n;
|
|
86
|
-
return (0,
|
|
86
|
+
return (0, create_date_string_ts_1.createDateString)(Math.floor(total / 12), total % 12);
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Add n calendar days to a DateString.
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const date_string_ts_1 = require("./date-string.js");
|
|
4
4
|
test("toDateString reads UTC date components from ISO-string Date", () => {
|
|
5
|
-
expect((0,
|
|
6
|
-
expect((0,
|
|
7
|
-
expect((0,
|
|
5
|
+
expect((0, date_string_ts_1.toDateString)(new Date("2026-10-25T00:00:00Z"))).toBe("2026-10-25");
|
|
6
|
+
expect((0, date_string_ts_1.toDateString)(new Date("2026-03-29T00:00:00Z"))).toBe("2026-03-29");
|
|
7
|
+
expect((0, date_string_ts_1.toDateString)(new Date("2021-01-01T00:00:00Z"))).toBe("2021-01-01");
|
|
8
8
|
});
|
|
9
9
|
test("toDateString reads local date components from local-constructor Date", () => {
|
|
10
10
|
// new Date(y, m, d) creates local midnight — must give same DateString as ISO string
|
|
11
|
-
expect((0,
|
|
12
|
-
expect((0,
|
|
13
|
-
expect((0,
|
|
14
|
-
expect((0,
|
|
11
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 9, 25))).toBe("2026-10-25");
|
|
12
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 2, 29))).toBe("2026-03-29");
|
|
13
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2025, 11, 31))).toBe("2025-12-31");
|
|
14
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 0, 1))).toBe("2026-01-01");
|
|
15
15
|
});
|
|
16
16
|
test("toDateString: ISO string and local constructor give the same DateString for the same calendar day", () => {
|
|
17
|
-
expect((0,
|
|
18
|
-
expect((0,
|
|
19
|
-
expect((0,
|
|
17
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 9, 25))).toBe((0, date_string_ts_1.toDateString)(new Date("2026-10-25")));
|
|
18
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2025, 11, 31))).toBe((0, date_string_ts_1.toDateString)(new Date("2025-12-31")));
|
|
19
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 0, 1))).toBe((0, date_string_ts_1.toDateString)(new Date("2026-01-01")));
|
|
20
20
|
});
|
|
21
21
|
test("toDateString zero-pads month and day", () => {
|
|
22
|
-
expect((0,
|
|
23
|
-
expect((0,
|
|
22
|
+
expect((0, date_string_ts_1.toDateString)(new Date(Date.UTC(2021, 0, 5)))).toBe("2021-01-05");
|
|
23
|
+
expect((0, date_string_ts_1.toDateString)(new Date(Date.UTC(2021, 8, 3)))).toBe("2021-09-03");
|
|
24
24
|
});
|
|
25
25
|
test("fromDateString returns UTC midnight Date", () => {
|
|
26
|
-
const d = (0,
|
|
26
|
+
const d = (0, date_string_ts_1.fromDateString)("2026-10-25");
|
|
27
27
|
expect(d.getUTCFullYear()).toBe(2026);
|
|
28
28
|
expect(d.getUTCMonth()).toBe(9);
|
|
29
29
|
expect(d.getUTCDate()).toBe(25);
|
|
@@ -32,34 +32,34 @@ test("fromDateString returns UTC midnight Date", () => {
|
|
|
32
32
|
});
|
|
33
33
|
test("toDateString and fromDateString are inverses", () => {
|
|
34
34
|
const s = "2026-10-25";
|
|
35
|
-
expect((0,
|
|
35
|
+
expect((0, date_string_ts_1.toDateString)((0, date_string_ts_1.fromDateString)(s))).toBe(s);
|
|
36
36
|
});
|
|
37
37
|
test("addDays adds calendar days across DST fall-back (Oct 25 2026)", () => {
|
|
38
|
-
expect((0,
|
|
39
|
-
expect((0,
|
|
38
|
+
expect((0, date_string_ts_1.addDays)("2026-10-24", 1)).toBe("2026-10-25");
|
|
39
|
+
expect((0, date_string_ts_1.addDays)("2026-10-25", 1)).toBe("2026-10-26");
|
|
40
40
|
});
|
|
41
41
|
test("addDays adds calendar days across DST spring-forward (Mar 29 2026)", () => {
|
|
42
|
-
expect((0,
|
|
43
|
-
expect((0,
|
|
42
|
+
expect((0, date_string_ts_1.addDays)("2026-03-28", 1)).toBe("2026-03-29");
|
|
43
|
+
expect((0, date_string_ts_1.addDays)("2026-03-29", 1)).toBe("2026-03-30");
|
|
44
44
|
});
|
|
45
45
|
test("addDays with negative n subtracts days", () => {
|
|
46
|
-
expect((0,
|
|
47
|
-
expect((0,
|
|
46
|
+
expect((0, date_string_ts_1.addDays)("2026-10-25", -1)).toBe("2026-10-24");
|
|
47
|
+
expect((0, date_string_ts_1.addDays)("2026-10-01", -1)).toBe("2026-09-30");
|
|
48
48
|
});
|
|
49
49
|
test("addDays with n=0 returns same date", () => {
|
|
50
|
-
expect((0,
|
|
50
|
+
expect((0, date_string_ts_1.addDays)("2026-10-25", 0)).toBe("2026-10-25");
|
|
51
51
|
});
|
|
52
52
|
test("addMonths advances by positive months", () => {
|
|
53
|
-
expect((0,
|
|
54
|
-
expect((0,
|
|
55
|
-
expect((0,
|
|
53
|
+
expect((0, date_string_ts_1.addMonths)("2026-04-01", 1)).toBe("2026-05-01");
|
|
54
|
+
expect((0, date_string_ts_1.addMonths)("2026-11-01", 2)).toBe("2027-01-01");
|
|
55
|
+
expect((0, date_string_ts_1.addMonths)("2026-04-15", 1)).toBe("2026-05-01");
|
|
56
56
|
});
|
|
57
57
|
test("addMonths goes back with negative months", () => {
|
|
58
|
-
expect((0,
|
|
59
|
-
expect((0,
|
|
58
|
+
expect((0, date_string_ts_1.addMonths)("2026-03-01", -1)).toBe("2026-02-01");
|
|
59
|
+
expect((0, date_string_ts_1.addMonths)("2026-01-01", -1)).toBe("2025-12-01");
|
|
60
60
|
});
|
|
61
61
|
test("addMonths with n=0 returns first of same month", () => {
|
|
62
|
-
expect((0,
|
|
62
|
+
expect((0, date_string_ts_1.addMonths)("2026-04-15", 0)).toBe("2026-04-01");
|
|
63
63
|
});
|
|
64
64
|
describe("todayDateString", () => {
|
|
65
65
|
// 0:30 in Prague is still the previous day in UTC
|
|
@@ -70,20 +70,20 @@ describe("todayDateString", () => {
|
|
|
70
70
|
["Asia/Tokyo", "2026-11-21"],
|
|
71
71
|
["UTC", "2026-11-20"],
|
|
72
72
|
])("is the calendar day in %s", (timeZone, expected) => {
|
|
73
|
-
expect((0,
|
|
73
|
+
expect((0, date_string_ts_1.todayDateString)(PRAGUE_HALF_PAST_MIDNIGHT, timeZone)).toBe(expected);
|
|
74
74
|
});
|
|
75
75
|
test("counts summer time", () => {
|
|
76
|
-
expect((0,
|
|
76
|
+
expect((0, date_string_ts_1.todayDateString)(Date.parse("2026-07-20T22:30:00Z"), "Europe/Prague")).toBe("2026-07-21");
|
|
77
77
|
});
|
|
78
78
|
test.each(["", "Europe/Praha"])("falls back to the device's day for the unknown time zone %j", (timeZone) => {
|
|
79
79
|
const warn = jest.spyOn(console, "warn").mockImplementation(() => undefined);
|
|
80
|
-
expect((0,
|
|
80
|
+
expect((0, date_string_ts_1.todayDateString)(PRAGUE_HALF_PAST_MIDNIGHT, timeZone)).toBe((0, date_string_ts_1.todayDateString)(PRAGUE_HALF_PAST_MIDNIGHT));
|
|
81
81
|
warn.mockRestore();
|
|
82
82
|
});
|
|
83
83
|
test("warns about an unknown time zone once, not on every call", () => {
|
|
84
84
|
const warn = jest.spyOn(console, "warn").mockImplementation(() => undefined);
|
|
85
|
-
(0,
|
|
86
|
-
(0,
|
|
85
|
+
(0, date_string_ts_1.todayDateString)(PRAGUE_HALF_PAST_MIDNIGHT, "Unknown/Warned_Once");
|
|
86
|
+
(0, date_string_ts_1.todayDateString)(PRAGUE_HALF_PAST_MIDNIGHT, "Unknown/Warned_Once");
|
|
87
87
|
expect(warn).toHaveBeenCalledTimes(1);
|
|
88
88
|
expect(warn).toHaveBeenCalledWith(expect.stringContaining('"Unknown/Warned_Once"'));
|
|
89
89
|
warn.mockRestore();
|
package/utils/dayjs-utils.d.ts
CHANGED
package/utils/dayjs-utils.js
CHANGED
|
@@ -1,50 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
38
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
6
|
exports.dayjsEnWithTz = void 0;
|
|
40
|
-
const dayjs_1 =
|
|
41
|
-
require("dayjs/locale/en");
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
require("dayjs/locale/en.js");
|
|
9
|
+
const isBetween_js_1 = __importDefault(require("dayjs/plugin/isBetween.js"));
|
|
10
|
+
const timezone_js_1 = __importDefault(require("dayjs/plugin/timezone.js"));
|
|
11
|
+
const utc_js_1 = __importDefault(require("dayjs/plugin/utc.js"));
|
|
12
|
+
dayjs_1.default.extend(isBetween_js_1.default);
|
|
13
|
+
dayjs_1.default.extend(timezone_js_1.default);
|
|
14
|
+
dayjs_1.default.extend(utc_js_1.default);
|
|
48
15
|
const dayjsEnWithTz = (value, tz = "UTC") => {
|
|
49
16
|
return (0, dayjs_1.default)(value).tz(tz).locale("en");
|
|
50
17
|
};
|
|
@@ -10,57 +10,57 @@
|
|
|
10
10
|
* npm run test:tz:tokyo -w @uxf/datepicker
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
13
|
+
const can_select_range_ts_1 = require("./can-select-range.js");
|
|
14
|
+
const date_string_ts_1 = require("./date-string.js");
|
|
15
|
+
const get_current_year_month_and_date_ts_1 = require("./get-current-year-month-and-date.js");
|
|
16
|
+
const get_days_ts_1 = require("./get-days.js");
|
|
17
|
+
const get_weekday_labels_ts_1 = require("./get-weekday-labels.js");
|
|
18
|
+
const get_years_ts_1 = require("./get-years.js");
|
|
19
|
+
const is_date_blocked_ts_1 = require("./is-date-blocked.js");
|
|
20
|
+
const is_date_hovered_ts_1 = require("./is-date-hovered.js");
|
|
21
|
+
const is_date_inside_range_ts_1 = require("./is-date-inside-range.js");
|
|
22
|
+
const is_end_date_ts_1 = require("./is-end-date.js");
|
|
23
|
+
const is_first_or_last_selected_date_ts_1 = require("./is-first-or-last-selected-date.js");
|
|
24
|
+
const is_in_unavailable_dates_ts_1 = require("./is-in-unavailable-dates.js");
|
|
25
|
+
const is_start_date_ts_1 = require("./is-start-date.js");
|
|
26
26
|
// Oct 25 2026 = DST fall-back in Europe/Prague (25h day, clocks go back)
|
|
27
27
|
// Mar 29 2026 = DST spring-forward in Europe/Prague (23h day, clocks go forward)
|
|
28
28
|
// Asia/Tokyo = UTC+9, no DST — local midnight is UTC previous-day 15:00 (extreme offset)
|
|
29
29
|
describe("toDateString: local constructor vs ISO string are equivalent (any timezone)", () => {
|
|
30
30
|
test("DST fall-back day: new Date(2026, 9, 25) === new Date('2026-10-25')", () => {
|
|
31
31
|
// new Date(2026, 9, 25) = local midnight — different UTC timestamp than ISO string in UTC+ zones
|
|
32
|
-
expect((0,
|
|
33
|
-
expect((0,
|
|
34
|
-
expect((0,
|
|
32
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 9, 25))).toBe("2026-10-25");
|
|
33
|
+
expect((0, date_string_ts_1.toDateString)(new Date("2026-10-25"))).toBe("2026-10-25");
|
|
34
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 9, 25))).toBe((0, date_string_ts_1.toDateString)(new Date("2026-10-25")));
|
|
35
35
|
});
|
|
36
36
|
test("DST spring-forward day: new Date(2026, 2, 29) === new Date('2026-03-29')", () => {
|
|
37
|
-
expect((0,
|
|
38
|
-
expect((0,
|
|
37
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 2, 29))).toBe("2026-03-29");
|
|
38
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 2, 29))).toBe((0, date_string_ts_1.toDateString)(new Date("2026-03-29")));
|
|
39
39
|
});
|
|
40
40
|
test("year-end: new Date(2025, 11, 31) === new Date('2025-12-31')", () => {
|
|
41
|
-
expect((0,
|
|
42
|
-
expect((0,
|
|
41
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2025, 11, 31))).toBe("2025-12-31");
|
|
42
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2025, 11, 31))).toBe((0, date_string_ts_1.toDateString)(new Date("2025-12-31")));
|
|
43
43
|
});
|
|
44
44
|
test("year-start: new Date(2026, 0, 1) === new Date('2026-01-01')", () => {
|
|
45
|
-
expect((0,
|
|
46
|
-
expect((0,
|
|
45
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 0, 1))).toBe("2026-01-01");
|
|
46
|
+
expect((0, date_string_ts_1.toDateString)(new Date(2026, 0, 1))).toBe((0, date_string_ts_1.toDateString)(new Date("2026-01-01")));
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
describe("DST fall-back Oct 25 2026 (Europe/Prague)", () => {
|
|
50
50
|
test("isStartDate: date on DST boundary matches", () => {
|
|
51
|
-
expect((0,
|
|
52
|
-
expect((0,
|
|
53
|
-
expect((0,
|
|
51
|
+
expect((0, is_start_date_ts_1.isStartDate)("2026-10-25", "2026-10-25")).toBe(true);
|
|
52
|
+
expect((0, is_start_date_ts_1.isStartDate)("2026-10-24", "2026-10-25")).toBe(false);
|
|
53
|
+
expect((0, is_start_date_ts_1.isStartDate)("2026-10-26", "2026-10-25")).toBe(false);
|
|
54
54
|
});
|
|
55
55
|
test("isDateInsideRange: date on DST fall-back boundary is inside range", () => {
|
|
56
|
-
expect((0,
|
|
56
|
+
expect((0, is_date_inside_range_ts_1.isDateInsideRange)("2026-10-25", "2026-10-24", "2026-10-26")).toBe(true);
|
|
57
57
|
});
|
|
58
58
|
test("isInUnavailableDates: date on DST boundary found in list", () => {
|
|
59
|
-
expect((0,
|
|
60
|
-
expect((0,
|
|
59
|
+
expect((0, is_in_unavailable_dates_ts_1.isInUnavailableDates)(["2026-10-25"], "2026-10-25")).toBe(true);
|
|
60
|
+
expect((0, is_in_unavailable_dates_ts_1.isInUnavailableDates)(["2026-10-24"], "2026-10-25")).toBe(false);
|
|
61
61
|
});
|
|
62
62
|
test("canSelectRange: 2-day range across DST fall-back is valid", () => {
|
|
63
|
-
expect((0,
|
|
63
|
+
expect((0, can_select_range_ts_1.canSelectRange)({
|
|
64
64
|
startDate: "2026-10-25",
|
|
65
65
|
endDate: "2026-10-26",
|
|
66
66
|
minBookingDays: 2,
|
|
@@ -71,7 +71,7 @@ describe("DST fall-back Oct 25 2026 (Europe/Prague)", () => {
|
|
|
71
71
|
})).toBe(true);
|
|
72
72
|
});
|
|
73
73
|
test("isDateBlocked: date on DST boundary not blocked when minBookingDate is same day", () => {
|
|
74
|
-
expect((0,
|
|
74
|
+
expect((0, is_date_blocked_ts_1.isDateBlocked)({
|
|
75
75
|
date: "2026-10-25",
|
|
76
76
|
startDate: null,
|
|
77
77
|
endDate: null,
|
|
@@ -79,15 +79,15 @@ describe("DST fall-back Oct 25 2026 (Europe/Prague)", () => {
|
|
|
79
79
|
})).toBe(false);
|
|
80
80
|
});
|
|
81
81
|
test("isEndDate: date on DST boundary matches endDate", () => {
|
|
82
|
-
expect((0,
|
|
83
|
-
expect((0,
|
|
82
|
+
expect((0, is_end_date_ts_1.isEndDate)("2026-10-25", "2026-10-25")).toBe(true);
|
|
83
|
+
expect((0, is_end_date_ts_1.isEndDate)("2026-10-24", "2026-10-25")).toBe(false);
|
|
84
84
|
});
|
|
85
85
|
test("isFirstOrLastSelectedDate: DST boundary date matches start or end", () => {
|
|
86
|
-
expect((0,
|
|
87
|
-
expect((0,
|
|
86
|
+
expect((0, is_first_or_last_selected_date_ts_1.isFirstOrLastSelectedDate)("2026-10-25", "2026-10-25", "2026-10-28")).toBe(true);
|
|
87
|
+
expect((0, is_first_or_last_selected_date_ts_1.isFirstOrLastSelectedDate)("2026-10-28", "2026-10-25", "2026-10-28")).toBe(true);
|
|
88
88
|
});
|
|
89
89
|
test("isDateBlocked: date on DST boundary not blocked when maxBookingDate is same day", () => {
|
|
90
|
-
expect((0,
|
|
90
|
+
expect((0, is_date_blocked_ts_1.isDateBlocked)({
|
|
91
91
|
date: "2026-10-25",
|
|
92
92
|
startDate: null,
|
|
93
93
|
endDate: null,
|
|
@@ -98,7 +98,7 @@ describe("DST fall-back Oct 25 2026 (Europe/Prague)", () => {
|
|
|
98
98
|
});
|
|
99
99
|
describe("DST spring-forward Mar 29 2026 (Europe/Prague)", () => {
|
|
100
100
|
test("canSelectRange: 2-day range across DST spring-forward is valid", () => {
|
|
101
|
-
expect((0,
|
|
101
|
+
expect((0, can_select_range_ts_1.canSelectRange)({
|
|
102
102
|
startDate: "2026-03-29",
|
|
103
103
|
endDate: "2026-03-30",
|
|
104
104
|
minBookingDays: 2,
|
|
@@ -109,28 +109,28 @@ describe("DST spring-forward Mar 29 2026 (Europe/Prague)", () => {
|
|
|
109
109
|
})).toBe(true);
|
|
110
110
|
});
|
|
111
111
|
test("isDateInsideRange: date on spring-forward boundary is inside range", () => {
|
|
112
|
-
expect((0,
|
|
112
|
+
expect((0, is_date_inside_range_ts_1.isDateInsideRange)("2026-03-29", "2026-03-28", "2026-03-30")).toBe(true);
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
describe("UTC+9 (Asia/Tokyo, no DST) — year-end boundary Dec 31 2025 / Jan 1 2026", () => {
|
|
116
116
|
test("isStartDate: year-end date matches", () => {
|
|
117
|
-
expect((0,
|
|
118
|
-
expect((0,
|
|
117
|
+
expect((0, is_start_date_ts_1.isStartDate)("2025-12-31", "2025-12-31")).toBe(true);
|
|
118
|
+
expect((0, is_start_date_ts_1.isStartDate)("2026-01-01", "2025-12-31")).toBe(false);
|
|
119
119
|
});
|
|
120
120
|
test("isEndDate: New Year's Day matches", () => {
|
|
121
|
-
expect((0,
|
|
122
|
-
expect((0,
|
|
121
|
+
expect((0, is_end_date_ts_1.isEndDate)("2026-01-01", "2026-01-01")).toBe(true);
|
|
122
|
+
expect((0, is_end_date_ts_1.isEndDate)("2025-12-31", "2026-01-01")).toBe(false);
|
|
123
123
|
});
|
|
124
124
|
test("isDateInsideRange: date on year-end boundary is inside range", () => {
|
|
125
|
-
expect((0,
|
|
126
|
-
expect((0,
|
|
125
|
+
expect((0, is_date_inside_range_ts_1.isDateInsideRange)("2025-12-31", "2025-12-30", "2026-01-01")).toBe(true);
|
|
126
|
+
expect((0, is_date_inside_range_ts_1.isDateInsideRange)("2026-01-01", "2025-12-31", "2026-01-02")).toBe(true);
|
|
127
127
|
});
|
|
128
128
|
test("isInUnavailableDates: year-end date found in list", () => {
|
|
129
|
-
expect((0,
|
|
130
|
-
expect((0,
|
|
129
|
+
expect((0, is_in_unavailable_dates_ts_1.isInUnavailableDates)(["2025-12-31"], "2025-12-31")).toBe(true);
|
|
130
|
+
expect((0, is_in_unavailable_dates_ts_1.isInUnavailableDates)(["2025-12-31"], "2026-01-01")).toBe(false);
|
|
131
131
|
});
|
|
132
132
|
test("canSelectRange: 2-day range spanning year boundary is valid", () => {
|
|
133
|
-
expect((0,
|
|
133
|
+
expect((0, can_select_range_ts_1.canSelectRange)({
|
|
134
134
|
startDate: "2025-12-31",
|
|
135
135
|
endDate: "2026-01-01",
|
|
136
136
|
minBookingDays: 2,
|
|
@@ -141,7 +141,7 @@ describe("UTC+9 (Asia/Tokyo, no DST) — year-end boundary Dec 31 2025 / Jan 1 2
|
|
|
141
141
|
})).toBe(true);
|
|
142
142
|
});
|
|
143
143
|
test("canSelectRange: startDate on minBookingDate at year boundary is valid", () => {
|
|
144
|
-
expect((0,
|
|
144
|
+
expect((0, can_select_range_ts_1.canSelectRange)({
|
|
145
145
|
startDate: "2026-01-01",
|
|
146
146
|
endDate: null,
|
|
147
147
|
minBookingDays: 1,
|
|
@@ -152,7 +152,7 @@ describe("UTC+9 (Asia/Tokyo, no DST) — year-end boundary Dec 31 2025 / Jan 1 2
|
|
|
152
152
|
})).toBe(true);
|
|
153
153
|
});
|
|
154
154
|
test("canSelectRange: endDate within maxBookingDate at year boundary is valid", () => {
|
|
155
|
-
expect((0,
|
|
155
|
+
expect((0, can_select_range_ts_1.canSelectRange)({
|
|
156
156
|
startDate: "2025-12-30",
|
|
157
157
|
endDate: "2025-12-31",
|
|
158
158
|
minBookingDays: 2,
|
|
@@ -163,7 +163,7 @@ describe("UTC+9 (Asia/Tokyo, no DST) — year-end boundary Dec 31 2025 / Jan 1 2
|
|
|
163
163
|
})).toBe(true);
|
|
164
164
|
});
|
|
165
165
|
test("isDateBlocked: Dec 31 not blocked when minBookingDate is Dec 31", () => {
|
|
166
|
-
expect((0,
|
|
166
|
+
expect((0, is_date_blocked_ts_1.isDateBlocked)({
|
|
167
167
|
date: "2025-12-31",
|
|
168
168
|
startDate: null,
|
|
169
169
|
endDate: null,
|
|
@@ -171,7 +171,7 @@ describe("UTC+9 (Asia/Tokyo, no DST) — year-end boundary Dec 31 2025 / Jan 1 2
|
|
|
171
171
|
})).toBe(false);
|
|
172
172
|
});
|
|
173
173
|
test("isDateBlocked: Jan 1 not blocked when maxBookingDate is Jan 1", () => {
|
|
174
|
-
expect((0,
|
|
174
|
+
expect((0, is_date_blocked_ts_1.isDateBlocked)({
|
|
175
175
|
date: "2026-01-01",
|
|
176
176
|
startDate: null,
|
|
177
177
|
endDate: null,
|
|
@@ -179,7 +179,7 @@ describe("UTC+9 (Asia/Tokyo, no DST) — year-end boundary Dec 31 2025 / Jan 1 2
|
|
|
179
179
|
})).toBe(false);
|
|
180
180
|
});
|
|
181
181
|
test("isDateBlocked: Dec 30 blocked when minBookingDate is Dec 31", () => {
|
|
182
|
-
expect((0,
|
|
182
|
+
expect((0, is_date_blocked_ts_1.isDateBlocked)({
|
|
183
183
|
date: "2025-12-30",
|
|
184
184
|
startDate: null,
|
|
185
185
|
endDate: null,
|
|
@@ -187,7 +187,7 @@ describe("UTC+9 (Asia/Tokyo, no DST) — year-end boundary Dec 31 2025 / Jan 1 2
|
|
|
187
187
|
})).toBe(true);
|
|
188
188
|
});
|
|
189
189
|
test("isDateBlocked: Jan 2 blocked when maxBookingDate is Jan 1", () => {
|
|
190
|
-
expect((0,
|
|
190
|
+
expect((0, is_date_blocked_ts_1.isDateBlocked)({
|
|
191
191
|
date: "2026-01-02",
|
|
192
192
|
startDate: null,
|
|
193
193
|
endDate: null,
|
|
@@ -195,12 +195,12 @@ describe("UTC+9 (Asia/Tokyo, no DST) — year-end boundary Dec 31 2025 / Jan 1 2
|
|
|
195
195
|
})).toBe(true);
|
|
196
196
|
});
|
|
197
197
|
test("isFirstOrLastSelectedDate: year-end and new year match start/end", () => {
|
|
198
|
-
expect((0,
|
|
199
|
-
expect((0,
|
|
200
|
-
expect((0,
|
|
198
|
+
expect((0, is_first_or_last_selected_date_ts_1.isFirstOrLastSelectedDate)("2025-12-31", "2025-12-31", "2026-01-03")).toBe(true);
|
|
199
|
+
expect((0, is_first_or_last_selected_date_ts_1.isFirstOrLastSelectedDate)("2026-01-03", "2025-12-31", "2026-01-03")).toBe(true);
|
|
200
|
+
expect((0, is_first_or_last_selected_date_ts_1.isFirstOrLastSelectedDate)("2026-01-01", "2025-12-31", "2026-01-03")).toBe(false);
|
|
201
201
|
});
|
|
202
202
|
test("isDateHovered: date between startDate and hoveredDate highlighted across year boundary", () => {
|
|
203
|
-
expect((0,
|
|
203
|
+
expect((0, is_date_hovered_ts_1.isDateHovered)({
|
|
204
204
|
date: "2025-12-31",
|
|
205
205
|
startDate: "2025-12-29",
|
|
206
206
|
endDate: null,
|
|
@@ -221,26 +221,26 @@ describe("getDays: month boundaries correct in UTC+ timezone", () => {
|
|
|
221
221
|
// 2026-04-30T23:59:59.999Z which local-methods read as 2026-05-01 →
|
|
222
222
|
// monthEndStr becomes "2026-05-01", so May 1 ends up in the current-month slice.
|
|
223
223
|
test("April 2026 calendar has exactly 35 days (5 weeks, firstDayOfWeek=1)", () => {
|
|
224
|
-
const days = (0,
|
|
224
|
+
const days = (0, get_days_ts_1.getDays)({ year: 2026, month: 3, firstDayOfWeek: 1 });
|
|
225
225
|
expect(days).toHaveLength(35);
|
|
226
226
|
});
|
|
227
227
|
test("last current-month day in April 2026 is April 30", () => {
|
|
228
|
-
const days = (0,
|
|
228
|
+
const days = (0, get_days_ts_1.getDays)({ year: 2026, month: 3, firstDayOfWeek: 1 });
|
|
229
229
|
const currentMonthDays = days.filter((d) => d.currentMonth);
|
|
230
230
|
expect(currentMonthDays).toHaveLength(30);
|
|
231
231
|
const last = currentMonthDays[currentMonthDays.length - 1];
|
|
232
|
-
expect((0,
|
|
232
|
+
expect((0, date_string_ts_1.toDateString)(last.date)).toBe("2026-04-30");
|
|
233
233
|
});
|
|
234
234
|
test("May 1 appears as overflow (currentMonth: false) in April 2026 calendar", () => {
|
|
235
|
-
const days = (0,
|
|
236
|
-
const may1 = days.find((d) => (0,
|
|
235
|
+
const days = (0, get_days_ts_1.getDays)({ year: 2026, month: 3, firstDayOfWeek: 1 });
|
|
236
|
+
const may1 = days.find((d) => (0, date_string_ts_1.toDateString)(d.date) === "2026-05-01");
|
|
237
237
|
expect(may1).toBeDefined();
|
|
238
238
|
expect(may1 === null || may1 === void 0 ? void 0 : may1.currentMonth).toBe(false);
|
|
239
239
|
});
|
|
240
240
|
test("overflow days after April 2026 are May 1, 2, 3", () => {
|
|
241
|
-
const days = (0,
|
|
242
|
-
const overflow = days.filter((d) => !d.currentMonth && (0,
|
|
243
|
-
expect(overflow.map((d) => (0,
|
|
241
|
+
const days = (0, get_days_ts_1.getDays)({ year: 2026, month: 3, firstDayOfWeek: 1 });
|
|
242
|
+
const overflow = days.filter((d) => !d.currentMonth && (0, date_string_ts_1.toDateString)(d.date) >= "2026-05-01");
|
|
243
|
+
expect(overflow.map((d) => (0, date_string_ts_1.toDateString)(d.date))).toEqual(["2026-05-01", "2026-05-02", "2026-05-03"]);
|
|
244
244
|
});
|
|
245
245
|
});
|
|
246
246
|
describe("getWeekdayLabels: exactly 7 labels in UTC+ timezone", () => {
|
|
@@ -248,13 +248,13 @@ describe("getWeekdayLabels: exactly 7 labels in UTC+ timezone", () => {
|
|
|
248
248
|
// toDateString() falls back to local methods and shifts the date +1 day in UTC+
|
|
249
249
|
// timezones, so getEach() returns 8 dates → 8 labels (last one is a duplicate Mon).
|
|
250
250
|
test("returns exactly 7 labels with firstDayOfWeek=0", () => {
|
|
251
|
-
expect((0,
|
|
251
|
+
expect((0, get_weekday_labels_ts_1.getWeekdayLabels)({ firstDayOfWeek: 0 })).toHaveLength(7);
|
|
252
252
|
});
|
|
253
253
|
test("returns exactly 7 labels with firstDayOfWeek=1 (Monday-start)", () => {
|
|
254
|
-
expect((0,
|
|
254
|
+
expect((0, get_weekday_labels_ts_1.getWeekdayLabels)({ firstDayOfWeek: 1 })).toHaveLength(7);
|
|
255
255
|
});
|
|
256
256
|
test("Mo-start week is Mo…Su with no duplicates", () => {
|
|
257
|
-
expect((0,
|
|
257
|
+
expect((0, get_weekday_labels_ts_1.getWeekdayLabels)({ firstDayOfWeek: 1 })).toEqual(["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]);
|
|
258
258
|
});
|
|
259
259
|
});
|
|
260
260
|
describe("getYears: exactly 9 years for ±4 decade view in UTC+ timezone", () => {
|
|
@@ -264,12 +264,12 @@ describe("getYears: exactly 9 years for ±4 decade view in UTC+ timezone", () =>
|
|
|
264
264
|
test("year=2026: 9 years returned (2022–2030)", () => {
|
|
265
265
|
const startYear = new Date("2022-01-01");
|
|
266
266
|
const endYear = new Date("2030-01-01");
|
|
267
|
-
expect((0,
|
|
267
|
+
expect((0, get_years_ts_1.getYears)({ startYear, endYear })).toHaveLength(9);
|
|
268
268
|
});
|
|
269
269
|
test("year=2026: first year is 2022, last is 2030", () => {
|
|
270
270
|
const startYear = new Date("2022-01-01");
|
|
271
271
|
const endYear = new Date("2030-01-01");
|
|
272
|
-
const years = (0,
|
|
272
|
+
const years = (0, get_years_ts_1.getYears)({ startYear, endYear });
|
|
273
273
|
expect(years[0].yearLabel).toBe("2022");
|
|
274
274
|
expect(years[years.length - 1].yearLabel).toBe("2030");
|
|
275
275
|
});
|
|
@@ -287,7 +287,7 @@ describe("getCurrentYearMonthAndDate: returns local calendar month in UTC+ timez
|
|
|
287
287
|
// The function must always agree with the local calendar, whatever the offset.
|
|
288
288
|
jest.setSystemTime(new Date("2021-08-31T22:30:00Z"));
|
|
289
289
|
const expectedMonth = new Date("2021-08-31T22:30:00Z").getMonth(); // local month
|
|
290
|
-
const result = (0,
|
|
290
|
+
const result = (0, get_current_year_month_and_date_ts_1.getCurrentYearMonthAndDate)();
|
|
291
291
|
expect(result.month).toBe(expectedMonth);
|
|
292
292
|
});
|
|
293
293
|
});
|
|
@@ -297,13 +297,13 @@ describe("todayDateString: the device's calendar day, not the UTC one", () => {
|
|
|
297
297
|
for (const iso of ["2026-11-20T22:30:00Z", "2026-11-21T03:30:00Z"]) {
|
|
298
298
|
const now = new Date(iso);
|
|
299
299
|
const local = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
|
|
300
|
-
expect((0,
|
|
300
|
+
expect((0, date_string_ts_1.todayDateString)(now.getTime())).toBe(local);
|
|
301
301
|
}
|
|
302
302
|
});
|
|
303
303
|
});
|
|
304
304
|
describe("Range boundary checks", () => {
|
|
305
305
|
test("canSelectRange: startDate on minBookingDate boundary is valid", () => {
|
|
306
|
-
expect((0,
|
|
306
|
+
expect((0, can_select_range_ts_1.canSelectRange)({
|
|
307
307
|
startDate: "2026-10-26",
|
|
308
308
|
endDate: null,
|
|
309
309
|
minBookingDays: 1,
|
|
@@ -314,7 +314,7 @@ describe("Range boundary checks", () => {
|
|
|
314
314
|
})).toBe(true);
|
|
315
315
|
});
|
|
316
316
|
test("canSelectRange: endDate within maxBookingDate boundary is valid", () => {
|
|
317
|
-
expect((0,
|
|
317
|
+
expect((0, can_select_range_ts_1.canSelectRange)({
|
|
318
318
|
startDate: "2026-10-24",
|
|
319
319
|
endDate: "2026-10-25",
|
|
320
320
|
minBookingDays: 2,
|
|
@@ -325,7 +325,7 @@ describe("Range boundary checks", () => {
|
|
|
325
325
|
})).toBe(true);
|
|
326
326
|
});
|
|
327
327
|
test("isDateHovered: date between startDate and hoveredDate is highlighted", () => {
|
|
328
|
-
expect((0,
|
|
328
|
+
expect((0, is_date_hovered_ts_1.isDateHovered)({
|
|
329
329
|
date: "2026-10-26",
|
|
330
330
|
startDate: "2026-10-24",
|
|
331
331
|
endDate: null,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MonthType } from "./types";
|
|
1
|
+
import { MonthType } from "./types.ts";
|
|
2
2
|
export declare function getCurrentYearMonthAndDate(): MonthType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCurrentYearMonthAndDate = getCurrentYearMonthAndDate;
|
|
4
|
-
const
|
|
4
|
+
const get_date_month_and_year_ts_1 = require("./get-date-month-and-year.js");
|
|
5
5
|
function getCurrentYearMonthAndDate() {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, get_date_month_and_year_ts_1.getDateMonthAndYear)(new Date());
|
|
7
7
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const get_current_year_month_and_date_ts_1 = require("./get-current-year-month-and-date.js");
|
|
4
4
|
beforeAll(() => {
|
|
5
5
|
jest.useFakeTimers();
|
|
6
6
|
});
|
|
7
7
|
test("getCurrentYearMonthAndDate", () => {
|
|
8
8
|
jest.setSystemTime(new Date("2021-08-10"));
|
|
9
|
-
expect((0,
|
|
9
|
+
expect((0, get_current_year_month_and_date_ts_1.getCurrentYearMonthAndDate)()).toStrictEqual({
|
|
10
10
|
year: 2021,
|
|
11
11
|
month: 7,
|
|
12
12
|
date: new Date("2021-08-01T00:00:00Z"),
|
|
13
13
|
});
|
|
14
14
|
jest.setSystemTime(new Date("2020-02-15"));
|
|
15
|
-
expect((0,
|
|
15
|
+
expect((0, get_current_year_month_and_date_ts_1.getCurrentYearMonthAndDate)()).toStrictEqual({
|
|
16
16
|
year: 2020,
|
|
17
17
|
month: 1,
|
|
18
18
|
date: new Date("2020-02-01T00:00:00Z"),
|