@uxf/datepicker 11.99.0 → 11.99.1
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/package.json
CHANGED
|
@@ -10,7 +10,7 @@ function getInitialMonths(numberOfMonths, startDate) {
|
|
|
10
10
|
let months = [firstMonth];
|
|
11
11
|
if (numberOfMonths > 1) {
|
|
12
12
|
months = Array.from(Array(numberOfMonths - 1).keys()).reduce((m) => {
|
|
13
|
-
prevMonthDate = (0, dayjs_utils_1.
|
|
13
|
+
prevMonthDate = (0, dayjs_utils_1.dayjsEnWithTz)(m[m.length - 1].date)
|
|
14
14
|
.add(1, "month")
|
|
15
15
|
.toDate();
|
|
16
16
|
return m.concat([(0, get_date_month_and_year_1.getDateMonthAndYear)(prevMonthDate)]);
|
|
@@ -24,6 +24,21 @@ test("getInitialMonths 2 months", () => {
|
|
|
24
24
|
},
|
|
25
25
|
]);
|
|
26
26
|
});
|
|
27
|
+
// ensures that it works correctly on DST change
|
|
28
|
+
test("getInitialMonths March", () => {
|
|
29
|
+
expect((0, get_initial_months_1.getInitialMonths)(2, new Date("2021-03-15"))).toStrictEqual([
|
|
30
|
+
{
|
|
31
|
+
date: new Date("2021-03-01T00:00:00Z"),
|
|
32
|
+
month: 2,
|
|
33
|
+
year: 2021,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
date: new Date("2021-04-01T00:00:00Z"),
|
|
37
|
+
month: 3,
|
|
38
|
+
year: 2021,
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
});
|
|
27
42
|
test("getInitialMonths without date", () => {
|
|
28
43
|
jest.useFakeTimers();
|
|
29
44
|
jest.setSystemTime(new Date("2021-09-15"));
|