@uxf/datepicker 11.96.0-canary.1 → 11.99.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.
Files changed (46) hide show
  1. package/hooks/use-date-picker-navigation.js +12 -12
  2. package/hooks/use-date-picker.js +5 -5
  3. package/hooks/use-date-picker.test.js +1 -1
  4. package/hooks/use-date-range-picker.js +29 -51
  5. package/hooks/use-date-range-picker.test.js +2 -2
  6. package/hooks/use-day.js +11 -13
  7. package/hooks/use-day.test.js +5 -5
  8. package/hooks/use-decade.js +5 -5
  9. package/hooks/use-decade.test.js +23 -23
  10. package/hooks/use-month.js +4 -4
  11. package/hooks/use-month.test.js +83 -83
  12. package/hooks/use-year.js +3 -3
  13. package/hooks/use-year.test.js +29 -29
  14. package/package.json +2 -6
  15. package/utils/can-select-range.js +7 -7
  16. package/utils/dayjs-utils.d.ts +4 -0
  17. package/utils/{dayjs-en.js → dayjs-utils.js} +8 -5
  18. package/utils/get-current-year-month-and-date.js +2 -2
  19. package/utils/get-current-year-month-and-date.test.js +2 -2
  20. package/utils/get-date-intervals.test.js +12 -8
  21. package/utils/get-date-invervals.js +3 -3
  22. package/utils/get-date-month-and-year.js +4 -4
  23. package/utils/get-date-month-and-year.test.js +2 -2
  24. package/utils/get-days.js +9 -9
  25. package/utils/get-days.test.js +123 -126
  26. package/utils/get-each.js +7 -29
  27. package/utils/get-each.test.js +17 -17
  28. package/utils/get-initial-months.js +2 -2
  29. package/utils/get-initial-months.test.js +4 -4
  30. package/utils/get-months.js +4 -4
  31. package/utils/get-months.test.js +27 -30
  32. package/utils/get-next-active-month.js +3 -3
  33. package/utils/get-next-active-month.test.js +14 -14
  34. package/utils/get-weekday-labels.js +4 -4
  35. package/utils/get-weekday-labels.test.js +3 -3
  36. package/utils/get-years.js +2 -2
  37. package/utils/get-years.test.js +12 -15
  38. package/utils/is-date-blocked.js +4 -4
  39. package/utils/is-date-hovered.d.ts +1 -1
  40. package/utils/is-date-hovered.js +23 -38
  41. package/utils/is-date-inside-range.js +2 -7
  42. package/utils/is-end-date.js +2 -2
  43. package/utils/is-first-or-last-selected-date.js +3 -10
  44. package/utils/is-in-unavailable-dates.js +2 -4
  45. package/utils/is-start-date.js +2 -2
  46. package/utils/dayjs-en.d.ts +0 -4
@@ -1,138 +1,135 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const dayjs_en_1 = require("./dayjs-en");
3
+ const dayjs_utils_1 = require("./dayjs-utils");
4
4
  const get_days_1 = require("./get-days");
5
5
  test("getDays", () => {
6
- expect((0, get_days_1.getDays)({ year: 2021, month: 0 }).map((d) => ({ ...d, date: d.date.toUTCString() }))).toStrictEqual([
7
- { dayLabel: "27", date: new Date("2020-12-27T00:00:00+01:00").toUTCString(), currentMonth: false },
8
- { dayLabel: "28", date: new Date("2020-12-28T00:00:00+01:00").toUTCString(), currentMonth: false },
9
- { dayLabel: "29", date: new Date("2020-12-29T00:00:00+01:00").toUTCString(), currentMonth: false },
10
- { dayLabel: "30", date: new Date("2020-12-30T00:00:00+01:00").toUTCString(), currentMonth: false },
11
- { dayLabel: "31", date: new Date("2020-12-31T00:00:00+01:00").toUTCString(), currentMonth: false },
12
- { dayLabel: "01", date: new Date("2021-01-01T00:00:00+01:00").toUTCString(), currentMonth: true },
13
- { dayLabel: "02", date: new Date("2021-01-02T00:00:00+01:00").toUTCString(), currentMonth: true },
14
- { dayLabel: "03", date: new Date("2021-01-03T00:00:00+01:00").toUTCString(), currentMonth: true },
15
- { dayLabel: "04", date: new Date("2021-01-04T00:00:00+01:00").toUTCString(), currentMonth: true },
16
- { dayLabel: "05", date: new Date("2021-01-05T00:00:00+01:00").toUTCString(), currentMonth: true },
17
- { dayLabel: "06", date: new Date("2021-01-06T00:00:00+01:00").toUTCString(), currentMonth: true },
18
- { dayLabel: "07", date: new Date("2021-01-07T00:00:00+01:00").toUTCString(), currentMonth: true },
19
- { dayLabel: "08", date: new Date("2021-01-08T00:00:00+01:00").toUTCString(), currentMonth: true },
20
- { dayLabel: "09", date: new Date("2021-01-09T00:00:00+01:00").toUTCString(), currentMonth: true },
21
- { dayLabel: "10", date: new Date("2021-01-10T00:00:00+01:00").toUTCString(), currentMonth: true },
22
- { dayLabel: "11", date: new Date("2021-01-11T00:00:00+01:00").toUTCString(), currentMonth: true },
23
- { dayLabel: "12", date: new Date("2021-01-12T00:00:00+01:00").toUTCString(), currentMonth: true },
24
- { dayLabel: "13", date: new Date("2021-01-13T00:00:00+01:00").toUTCString(), currentMonth: true },
25
- { dayLabel: "14", date: new Date("2021-01-14T00:00:00+01:00").toUTCString(), currentMonth: true },
26
- { dayLabel: "15", date: new Date("2021-01-15T00:00:00+01:00").toUTCString(), currentMonth: true },
27
- { dayLabel: "16", date: new Date("2021-01-16T00:00:00+01:00").toUTCString(), currentMonth: true },
28
- { dayLabel: "17", date: new Date("2021-01-17T00:00:00+01:00").toUTCString(), currentMonth: true },
29
- { dayLabel: "18", date: new Date("2021-01-18T00:00:00+01:00").toUTCString(), currentMonth: true },
30
- { dayLabel: "19", date: new Date("2021-01-19T00:00:00+01:00").toUTCString(), currentMonth: true },
31
- { dayLabel: "20", date: new Date("2021-01-20T00:00:00+01:00").toUTCString(), currentMonth: true },
32
- { dayLabel: "21", date: new Date("2021-01-21T00:00:00+01:00").toUTCString(), currentMonth: true },
33
- { dayLabel: "22", date: new Date("2021-01-22T00:00:00+01:00").toUTCString(), currentMonth: true },
34
- { dayLabel: "23", date: new Date("2021-01-23T00:00:00+01:00").toUTCString(), currentMonth: true },
35
- { dayLabel: "24", date: new Date("2021-01-24T00:00:00+01:00").toUTCString(), currentMonth: true },
36
- { dayLabel: "25", date: new Date("2021-01-25T00:00:00+01:00").toUTCString(), currentMonth: true },
37
- { dayLabel: "26", date: new Date("2021-01-26T00:00:00+01:00").toUTCString(), currentMonth: true },
38
- { dayLabel: "27", date: new Date("2021-01-27T00:00:00+01:00").toUTCString(), currentMonth: true },
39
- { dayLabel: "28", date: new Date("2021-01-28T00:00:00+01:00").toUTCString(), currentMonth: true },
40
- { dayLabel: "29", date: new Date("2021-01-29T00:00:00+01:00").toUTCString(), currentMonth: true },
41
- { dayLabel: "30", date: new Date("2021-01-30T00:00:00+01:00").toUTCString(), currentMonth: true },
42
- { dayLabel: "31", date: new Date("2021-01-31T00:00:00+01:00").toUTCString(), currentMonth: true },
43
- { dayLabel: "01", date: new Date("2021-02-01T00:00:00+01:00").toUTCString(), currentMonth: false },
44
- { dayLabel: "02", date: new Date("2021-02-02T00:00:00+01:00").toUTCString(), currentMonth: false },
45
- { dayLabel: "03", date: new Date("2021-02-03T00:00:00+01:00").toUTCString(), currentMonth: false },
46
- { dayLabel: "04", date: new Date("2021-02-04T00:00:00+01:00").toUTCString(), currentMonth: false },
47
- { dayLabel: "05", date: new Date("2021-02-05T00:00:00+01:00").toUTCString(), currentMonth: false },
48
- { dayLabel: "06", date: new Date("2021-02-06T00:00:00+01:00").toUTCString(), currentMonth: false },
6
+ expect((0, get_days_1.getDays)({ year: 2021, month: 0 })).toStrictEqual([
7
+ { dayLabel: "27", date: new Date("2020-12-27T00:00:00Z"), currentMonth: false },
8
+ { dayLabel: "28", date: new Date("2020-12-28T00:00:00Z"), currentMonth: false },
9
+ { dayLabel: "29", date: new Date("2020-12-29T00:00:00Z"), currentMonth: false },
10
+ { dayLabel: "30", date: new Date("2020-12-30T00:00:00Z"), currentMonth: false },
11
+ { dayLabel: "31", date: new Date("2020-12-31T00:00:00Z"), currentMonth: false },
12
+ { dayLabel: "01", date: new Date("2021-01-01T00:00:00Z"), currentMonth: true },
13
+ { dayLabel: "02", date: new Date("2021-01-02T00:00:00Z"), currentMonth: true },
14
+ { dayLabel: "03", date: new Date("2021-01-03T00:00:00Z"), currentMonth: true },
15
+ { dayLabel: "04", date: new Date("2021-01-04T00:00:00Z"), currentMonth: true },
16
+ { dayLabel: "05", date: new Date("2021-01-05T00:00:00Z"), currentMonth: true },
17
+ { dayLabel: "06", date: new Date("2021-01-06T00:00:00Z"), currentMonth: true },
18
+ { dayLabel: "07", date: new Date("2021-01-07T00:00:00Z"), currentMonth: true },
19
+ { dayLabel: "08", date: new Date("2021-01-08T00:00:00Z"), currentMonth: true },
20
+ { dayLabel: "09", date: new Date("2021-01-09T00:00:00Z"), currentMonth: true },
21
+ { dayLabel: "10", date: new Date("2021-01-10T00:00:00Z"), currentMonth: true },
22
+ { dayLabel: "11", date: new Date("2021-01-11T00:00:00Z"), currentMonth: true },
23
+ { dayLabel: "12", date: new Date("2021-01-12T00:00:00Z"), currentMonth: true },
24
+ { dayLabel: "13", date: new Date("2021-01-13T00:00:00Z"), currentMonth: true },
25
+ { dayLabel: "14", date: new Date("2021-01-14T00:00:00Z"), currentMonth: true },
26
+ { dayLabel: "15", date: new Date("2021-01-15T00:00:00Z"), currentMonth: true },
27
+ { dayLabel: "16", date: new Date("2021-01-16T00:00:00Z"), currentMonth: true },
28
+ { dayLabel: "17", date: new Date("2021-01-17T00:00:00Z"), currentMonth: true },
29
+ { dayLabel: "18", date: new Date("2021-01-18T00:00:00Z"), currentMonth: true },
30
+ { dayLabel: "19", date: new Date("2021-01-19T00:00:00Z"), currentMonth: true },
31
+ { dayLabel: "20", date: new Date("2021-01-20T00:00:00Z"), currentMonth: true },
32
+ { dayLabel: "21", date: new Date("2021-01-21T00:00:00Z"), currentMonth: true },
33
+ { dayLabel: "22", date: new Date("2021-01-22T00:00:00Z"), currentMonth: true },
34
+ { dayLabel: "23", date: new Date("2021-01-23T00:00:00Z"), currentMonth: true },
35
+ { dayLabel: "24", date: new Date("2021-01-24T00:00:00Z"), currentMonth: true },
36
+ { dayLabel: "25", date: new Date("2021-01-25T00:00:00Z"), currentMonth: true },
37
+ { dayLabel: "26", date: new Date("2021-01-26T00:00:00Z"), currentMonth: true },
38
+ { dayLabel: "27", date: new Date("2021-01-27T00:00:00Z"), currentMonth: true },
39
+ { dayLabel: "28", date: new Date("2021-01-28T00:00:00Z"), currentMonth: true },
40
+ { dayLabel: "29", date: new Date("2021-01-29T00:00:00Z"), currentMonth: true },
41
+ { dayLabel: "30", date: new Date("2021-01-30T00:00:00Z"), currentMonth: true },
42
+ { dayLabel: "31", date: new Date("2021-01-31T00:00:00Z"), currentMonth: true },
43
+ { dayLabel: "01", date: new Date("2021-02-01T00:00:00Z"), currentMonth: false },
44
+ { dayLabel: "02", date: new Date("2021-02-02T00:00:00Z"), currentMonth: false },
45
+ { dayLabel: "03", date: new Date("2021-02-03T00:00:00Z"), currentMonth: false },
46
+ { dayLabel: "04", date: new Date("2021-02-04T00:00:00Z"), currentMonth: false },
47
+ { dayLabel: "05", date: new Date("2021-02-05T00:00:00Z"), currentMonth: false },
48
+ { dayLabel: "06", date: new Date("2021-02-06T00:00:00Z"), currentMonth: false },
49
49
  ]);
50
50
  });
51
51
  test("getDays with custom format", () => {
52
- expect((0, get_days_1.getDays)({ year: 2021, month: 0, dayLabelFormat: (date) => (0, dayjs_en_1.dayjsEn)(date).format("D") }).map((d) => ({
53
- ...d,
54
- date: d.date.toUTCString(),
55
- }))).toStrictEqual([
56
- { dayLabel: "27", date: new Date("2020-12-27T00:00:00+01:00").toUTCString(), currentMonth: false },
57
- { dayLabel: "28", date: new Date("2020-12-28T00:00:00+01:00").toUTCString(), currentMonth: false },
58
- { dayLabel: "29", date: new Date("2020-12-29T00:00:00+01:00").toUTCString(), currentMonth: false },
59
- { dayLabel: "30", date: new Date("2020-12-30T00:00:00+01:00").toUTCString(), currentMonth: false },
60
- { dayLabel: "31", date: new Date("2020-12-31T00:00:00+01:00").toUTCString(), currentMonth: false },
61
- { dayLabel: "1", date: new Date("2021-01-01T00:00:00+01:00").toUTCString(), currentMonth: true },
62
- { dayLabel: "2", date: new Date("2021-01-02T00:00:00+01:00").toUTCString(), currentMonth: true },
63
- { dayLabel: "3", date: new Date("2021-01-03T00:00:00+01:00").toUTCString(), currentMonth: true },
64
- { dayLabel: "4", date: new Date("2021-01-04T00:00:00+01:00").toUTCString(), currentMonth: true },
65
- { dayLabel: "5", date: new Date("2021-01-05T00:00:00+01:00").toUTCString(), currentMonth: true },
66
- { dayLabel: "6", date: new Date("2021-01-06T00:00:00+01:00").toUTCString(), currentMonth: true },
67
- { dayLabel: "7", date: new Date("2021-01-07T00:00:00+01:00").toUTCString(), currentMonth: true },
68
- { dayLabel: "8", date: new Date("2021-01-08T00:00:00+01:00").toUTCString(), currentMonth: true },
69
- { dayLabel: "9", date: new Date("2021-01-09T00:00:00+01:00").toUTCString(), currentMonth: true },
70
- { dayLabel: "10", date: new Date("2021-01-10T00:00:00+01:00").toUTCString(), currentMonth: true },
71
- { dayLabel: "11", date: new Date("2021-01-11T00:00:00+01:00").toUTCString(), currentMonth: true },
72
- { dayLabel: "12", date: new Date("2021-01-12T00:00:00+01:00").toUTCString(), currentMonth: true },
73
- { dayLabel: "13", date: new Date("2021-01-13T00:00:00+01:00").toUTCString(), currentMonth: true },
74
- { dayLabel: "14", date: new Date("2021-01-14T00:00:00+01:00").toUTCString(), currentMonth: true },
75
- { dayLabel: "15", date: new Date("2021-01-15T00:00:00+01:00").toUTCString(), currentMonth: true },
76
- { dayLabel: "16", date: new Date("2021-01-16T00:00:00+01:00").toUTCString(), currentMonth: true },
77
- { dayLabel: "17", date: new Date("2021-01-17T00:00:00+01:00").toUTCString(), currentMonth: true },
78
- { dayLabel: "18", date: new Date("2021-01-18T00:00:00+01:00").toUTCString(), currentMonth: true },
79
- { dayLabel: "19", date: new Date("2021-01-19T00:00:00+01:00").toUTCString(), currentMonth: true },
80
- { dayLabel: "20", date: new Date("2021-01-20T00:00:00+01:00").toUTCString(), currentMonth: true },
81
- { dayLabel: "21", date: new Date("2021-01-21T00:00:00+01:00").toUTCString(), currentMonth: true },
82
- { dayLabel: "22", date: new Date("2021-01-22T00:00:00+01:00").toUTCString(), currentMonth: true },
83
- { dayLabel: "23", date: new Date("2021-01-23T00:00:00+01:00").toUTCString(), currentMonth: true },
84
- { dayLabel: "24", date: new Date("2021-01-24T00:00:00+01:00").toUTCString(), currentMonth: true },
85
- { dayLabel: "25", date: new Date("2021-01-25T00:00:00+01:00").toUTCString(), currentMonth: true },
86
- { dayLabel: "26", date: new Date("2021-01-26T00:00:00+01:00").toUTCString(), currentMonth: true },
87
- { dayLabel: "27", date: new Date("2021-01-27T00:00:00+01:00").toUTCString(), currentMonth: true },
88
- { dayLabel: "28", date: new Date("2021-01-28T00:00:00+01:00").toUTCString(), currentMonth: true },
89
- { dayLabel: "29", date: new Date("2021-01-29T00:00:00+01:00").toUTCString(), currentMonth: true },
90
- { dayLabel: "30", date: new Date("2021-01-30T00:00:00+01:00").toUTCString(), currentMonth: true },
91
- { dayLabel: "31", date: new Date("2021-01-31T00:00:00+01:00").toUTCString(), currentMonth: true },
92
- { dayLabel: "1", date: new Date("2021-02-01T00:00:00+01:00").toUTCString(), currentMonth: false },
93
- { dayLabel: "2", date: new Date("2021-02-02T00:00:00+01:00").toUTCString(), currentMonth: false },
94
- { dayLabel: "3", date: new Date("2021-02-03T00:00:00+01:00").toUTCString(), currentMonth: false },
95
- { dayLabel: "4", date: new Date("2021-02-04T00:00:00+01:00").toUTCString(), currentMonth: false },
96
- { dayLabel: "5", date: new Date("2021-02-05T00:00:00+01:00").toUTCString(), currentMonth: false },
97
- { dayLabel: "6", date: new Date("2021-02-06T00:00:00+01:00").toUTCString(), currentMonth: false },
52
+ expect((0, get_days_1.getDays)({ year: 2021, month: 0, dayLabelFormat: (date) => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("D") })).toStrictEqual([
53
+ { dayLabel: "27", date: new Date("2020-12-27T00:00:00Z"), currentMonth: false },
54
+ { dayLabel: "28", date: new Date("2020-12-28T00:00:00Z"), currentMonth: false },
55
+ { dayLabel: "29", date: new Date("2020-12-29T00:00:00Z"), currentMonth: false },
56
+ { dayLabel: "30", date: new Date("2020-12-30T00:00:00Z"), currentMonth: false },
57
+ { dayLabel: "31", date: new Date("2020-12-31T00:00:00Z"), currentMonth: false },
58
+ { dayLabel: "1", date: new Date("2021-01-01T00:00:00Z"), currentMonth: true },
59
+ { dayLabel: "2", date: new Date("2021-01-02T00:00:00Z"), currentMonth: true },
60
+ { dayLabel: "3", date: new Date("2021-01-03T00:00:00Z"), currentMonth: true },
61
+ { dayLabel: "4", date: new Date("2021-01-04T00:00:00Z"), currentMonth: true },
62
+ { dayLabel: "5", date: new Date("2021-01-05T00:00:00Z"), currentMonth: true },
63
+ { dayLabel: "6", date: new Date("2021-01-06T00:00:00Z"), currentMonth: true },
64
+ { dayLabel: "7", date: new Date("2021-01-07T00:00:00Z"), currentMonth: true },
65
+ { dayLabel: "8", date: new Date("2021-01-08T00:00:00Z"), currentMonth: true },
66
+ { dayLabel: "9", date: new Date("2021-01-09T00:00:00Z"), currentMonth: true },
67
+ { dayLabel: "10", date: new Date("2021-01-10T00:00:00Z"), currentMonth: true },
68
+ { dayLabel: "11", date: new Date("2021-01-11T00:00:00Z"), currentMonth: true },
69
+ { dayLabel: "12", date: new Date("2021-01-12T00:00:00Z"), currentMonth: true },
70
+ { dayLabel: "13", date: new Date("2021-01-13T00:00:00Z"), currentMonth: true },
71
+ { dayLabel: "14", date: new Date("2021-01-14T00:00:00Z"), currentMonth: true },
72
+ { dayLabel: "15", date: new Date("2021-01-15T00:00:00Z"), currentMonth: true },
73
+ { dayLabel: "16", date: new Date("2021-01-16T00:00:00Z"), currentMonth: true },
74
+ { dayLabel: "17", date: new Date("2021-01-17T00:00:00Z"), currentMonth: true },
75
+ { dayLabel: "18", date: new Date("2021-01-18T00:00:00Z"), currentMonth: true },
76
+ { dayLabel: "19", date: new Date("2021-01-19T00:00:00Z"), currentMonth: true },
77
+ { dayLabel: "20", date: new Date("2021-01-20T00:00:00Z"), currentMonth: true },
78
+ { dayLabel: "21", date: new Date("2021-01-21T00:00:00Z"), currentMonth: true },
79
+ { dayLabel: "22", date: new Date("2021-01-22T00:00:00Z"), currentMonth: true },
80
+ { dayLabel: "23", date: new Date("2021-01-23T00:00:00Z"), currentMonth: true },
81
+ { dayLabel: "24", date: new Date("2021-01-24T00:00:00Z"), currentMonth: true },
82
+ { dayLabel: "25", date: new Date("2021-01-25T00:00:00Z"), currentMonth: true },
83
+ { dayLabel: "26", date: new Date("2021-01-26T00:00:00Z"), currentMonth: true },
84
+ { dayLabel: "27", date: new Date("2021-01-27T00:00:00Z"), currentMonth: true },
85
+ { dayLabel: "28", date: new Date("2021-01-28T00:00:00Z"), currentMonth: true },
86
+ { dayLabel: "29", date: new Date("2021-01-29T00:00:00Z"), currentMonth: true },
87
+ { dayLabel: "30", date: new Date("2021-01-30T00:00:00Z"), currentMonth: true },
88
+ { dayLabel: "31", date: new Date("2021-01-31T00:00:00Z"), currentMonth: true },
89
+ { dayLabel: "1", date: new Date("2021-02-01T00:00:00Z"), currentMonth: false },
90
+ { dayLabel: "2", date: new Date("2021-02-02T00:00:00Z"), currentMonth: false },
91
+ { dayLabel: "3", date: new Date("2021-02-03T00:00:00Z"), currentMonth: false },
92
+ { dayLabel: "4", date: new Date("2021-02-04T00:00:00Z"), currentMonth: false },
93
+ { dayLabel: "5", date: new Date("2021-02-05T00:00:00Z"), currentMonth: false },
94
+ { dayLabel: "6", date: new Date("2021-02-06T00:00:00Z"), currentMonth: false },
98
95
  ]);
99
96
  });
100
97
  test("getDays with custom firstDayOfWeek", () => {
101
- expect((0, get_days_1.getDays)({ year: 2021, month: 0, firstDayOfWeek: 1 }).map((d) => ({ ...d, date: d.date.toUTCString() }))).toStrictEqual([
102
- { dayLabel: "28", date: new Date("2020-12-28T00:00:00+01:00").toUTCString(), currentMonth: false },
103
- { dayLabel: "29", date: new Date("2020-12-29T00:00:00+01:00").toUTCString(), currentMonth: false },
104
- { dayLabel: "30", date: new Date("2020-12-30T00:00:00+01:00").toUTCString(), currentMonth: false },
105
- { dayLabel: "31", date: new Date("2020-12-31T00:00:00+01:00").toUTCString(), currentMonth: false },
106
- { dayLabel: "01", date: new Date("2021-01-01T00:00:00+01:00").toUTCString(), currentMonth: true },
107
- { dayLabel: "02", date: new Date("2021-01-02T00:00:00+01:00").toUTCString(), currentMonth: true },
108
- { dayLabel: "03", date: new Date("2021-01-03T00:00:00+01:00").toUTCString(), currentMonth: true },
109
- { dayLabel: "04", date: new Date("2021-01-04T00:00:00+01:00").toUTCString(), currentMonth: true },
110
- { dayLabel: "05", date: new Date("2021-01-05T00:00:00+01:00").toUTCString(), currentMonth: true },
111
- { dayLabel: "06", date: new Date("2021-01-06T00:00:00+01:00").toUTCString(), currentMonth: true },
112
- { dayLabel: "07", date: new Date("2021-01-07T00:00:00+01:00").toUTCString(), currentMonth: true },
113
- { dayLabel: "08", date: new Date("2021-01-08T00:00:00+01:00").toUTCString(), currentMonth: true },
114
- { dayLabel: "09", date: new Date("2021-01-09T00:00:00+01:00").toUTCString(), currentMonth: true },
115
- { dayLabel: "10", date: new Date("2021-01-10T00:00:00+01:00").toUTCString(), currentMonth: true },
116
- { dayLabel: "11", date: new Date("2021-01-11T00:00:00+01:00").toUTCString(), currentMonth: true },
117
- { dayLabel: "12", date: new Date("2021-01-12T00:00:00+01:00").toUTCString(), currentMonth: true },
118
- { dayLabel: "13", date: new Date("2021-01-13T00:00:00+01:00").toUTCString(), currentMonth: true },
119
- { dayLabel: "14", date: new Date("2021-01-14T00:00:00+01:00").toUTCString(), currentMonth: true },
120
- { dayLabel: "15", date: new Date("2021-01-15T00:00:00+01:00").toUTCString(), currentMonth: true },
121
- { dayLabel: "16", date: new Date("2021-01-16T00:00:00+01:00").toUTCString(), currentMonth: true },
122
- { dayLabel: "17", date: new Date("2021-01-17T00:00:00+01:00").toUTCString(), currentMonth: true },
123
- { dayLabel: "18", date: new Date("2021-01-18T00:00:00+01:00").toUTCString(), currentMonth: true },
124
- { dayLabel: "19", date: new Date("2021-01-19T00:00:00+01:00").toUTCString(), currentMonth: true },
125
- { dayLabel: "20", date: new Date("2021-01-20T00:00:00+01:00").toUTCString(), currentMonth: true },
126
- { dayLabel: "21", date: new Date("2021-01-21T00:00:00+01:00").toUTCString(), currentMonth: true },
127
- { dayLabel: "22", date: new Date("2021-01-22T00:00:00+01:00").toUTCString(), currentMonth: true },
128
- { dayLabel: "23", date: new Date("2021-01-23T00:00:00+01:00").toUTCString(), currentMonth: true },
129
- { dayLabel: "24", date: new Date("2021-01-24T00:00:00+01:00").toUTCString(), currentMonth: true },
130
- { dayLabel: "25", date: new Date("2021-01-25T00:00:00+01:00").toUTCString(), currentMonth: true },
131
- { dayLabel: "26", date: new Date("2021-01-26T00:00:00+01:00").toUTCString(), currentMonth: true },
132
- { dayLabel: "27", date: new Date("2021-01-27T00:00:00+01:00").toUTCString(), currentMonth: true },
133
- { dayLabel: "28", date: new Date("2021-01-28T00:00:00+01:00").toUTCString(), currentMonth: true },
134
- { dayLabel: "29", date: new Date("2021-01-29T00:00:00+01:00").toUTCString(), currentMonth: true },
135
- { dayLabel: "30", date: new Date("2021-01-30T00:00:00+01:00").toUTCString(), currentMonth: true },
136
- { dayLabel: "31", date: new Date("2021-01-31T00:00:00+01:00").toUTCString(), currentMonth: true },
98
+ expect((0, get_days_1.getDays)({ year: 2021, month: 0, firstDayOfWeek: 1 })).toStrictEqual([
99
+ { dayLabel: "28", date: new Date("2020-12-28T00:00:00Z"), currentMonth: false },
100
+ { dayLabel: "29", date: new Date("2020-12-29T00:00:00Z"), currentMonth: false },
101
+ { dayLabel: "30", date: new Date("2020-12-30T00:00:00Z"), currentMonth: false },
102
+ { dayLabel: "31", date: new Date("2020-12-31T00:00:00Z"), currentMonth: false },
103
+ { dayLabel: "01", date: new Date("2021-01-01T00:00:00Z"), currentMonth: true },
104
+ { dayLabel: "02", date: new Date("2021-01-02T00:00:00Z"), currentMonth: true },
105
+ { dayLabel: "03", date: new Date("2021-01-03T00:00:00Z"), currentMonth: true },
106
+ { dayLabel: "04", date: new Date("2021-01-04T00:00:00Z"), currentMonth: true },
107
+ { dayLabel: "05", date: new Date("2021-01-05T00:00:00Z"), currentMonth: true },
108
+ { dayLabel: "06", date: new Date("2021-01-06T00:00:00Z"), currentMonth: true },
109
+ { dayLabel: "07", date: new Date("2021-01-07T00:00:00Z"), currentMonth: true },
110
+ { dayLabel: "08", date: new Date("2021-01-08T00:00:00Z"), currentMonth: true },
111
+ { dayLabel: "09", date: new Date("2021-01-09T00:00:00Z"), currentMonth: true },
112
+ { dayLabel: "10", date: new Date("2021-01-10T00:00:00Z"), currentMonth: true },
113
+ { dayLabel: "11", date: new Date("2021-01-11T00:00:00Z"), currentMonth: true },
114
+ { dayLabel: "12", date: new Date("2021-01-12T00:00:00Z"), currentMonth: true },
115
+ { dayLabel: "13", date: new Date("2021-01-13T00:00:00Z"), currentMonth: true },
116
+ { dayLabel: "14", date: new Date("2021-01-14T00:00:00Z"), currentMonth: true },
117
+ { dayLabel: "15", date: new Date("2021-01-15T00:00:00Z"), currentMonth: true },
118
+ { dayLabel: "16", date: new Date("2021-01-16T00:00:00Z"), currentMonth: true },
119
+ { dayLabel: "17", date: new Date("2021-01-17T00:00:00Z"), currentMonth: true },
120
+ { dayLabel: "18", date: new Date("2021-01-18T00:00:00Z"), currentMonth: true },
121
+ { dayLabel: "19", date: new Date("2021-01-19T00:00:00Z"), currentMonth: true },
122
+ { dayLabel: "20", date: new Date("2021-01-20T00:00:00Z"), currentMonth: true },
123
+ { dayLabel: "21", date: new Date("2021-01-21T00:00:00Z"), currentMonth: true },
124
+ { dayLabel: "22", date: new Date("2021-01-22T00:00:00Z"), currentMonth: true },
125
+ { dayLabel: "23", date: new Date("2021-01-23T00:00:00Z"), currentMonth: true },
126
+ { dayLabel: "24", date: new Date("2021-01-24T00:00:00Z"), currentMonth: true },
127
+ { dayLabel: "25", date: new Date("2021-01-25T00:00:00Z"), currentMonth: true },
128
+ { dayLabel: "26", date: new Date("2021-01-26T00:00:00Z"), currentMonth: true },
129
+ { dayLabel: "27", date: new Date("2021-01-27T00:00:00Z"), currentMonth: true },
130
+ { dayLabel: "28", date: new Date("2021-01-28T00:00:00Z"), currentMonth: true },
131
+ { dayLabel: "29", date: new Date("2021-01-29T00:00:00Z"), currentMonth: true },
132
+ { dayLabel: "30", date: new Date("2021-01-30T00:00:00Z"), currentMonth: true },
133
+ { dayLabel: "31", date: new Date("2021-01-31T00:00:00Z"), currentMonth: true },
137
134
  ]);
138
135
  });
package/utils/get-each.js CHANGED
@@ -1,40 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEach = getEach;
4
- const tz_1 = require("@date-fns/tz");
5
- const date_fns_1 = require("date-fns");
6
- const dayjs_en_1 = require("./dayjs-en");
7
- function getStartOf(date, type) {
8
- switch (type) {
9
- case "day":
10
- return (0, date_fns_1.startOfDay)(date);
11
- case "month":
12
- return (0, date_fns_1.startOfMonth)(date);
13
- case "year":
14
- return (0, date_fns_1.startOfYear)(date);
15
- }
16
- }
17
- function getNext(date, type) {
18
- switch (type) {
19
- case "day":
20
- return (0, date_fns_1.addDays)(date, 1);
21
- case "month":
22
- return (0, date_fns_1.addMonths)(date, 1);
23
- case "year":
24
- return (0, date_fns_1.addYears)(date, 1);
25
- }
26
- }
4
+ const dayjs_utils_1 = require("./dayjs-utils");
27
5
  function getEach(start, end, type) {
28
- const startOfStart = getStartOf(new tz_1.TZDate(start, dayjs_en_1.DEFAULT_TIMEZONE), type);
29
- const startOfEnd = getStartOf(new tz_1.TZDate(end, dayjs_en_1.DEFAULT_TIMEZONE), type);
30
- if (startOfStart > startOfEnd) {
6
+ const startOfStart = (0, dayjs_utils_1.dayjsEnWithTz)(start).startOf(type);
7
+ const startOfEnd = (0, dayjs_utils_1.dayjsEnWithTz)(end).startOf(type);
8
+ if (startOfStart.toDate().getTime() > startOfEnd.toDate().getTime()) {
31
9
  throw new Error("start must precede end");
32
10
  }
33
11
  const results = [];
34
12
  let current = startOfStart;
35
- while (current <= startOfEnd) {
36
- results.push(current);
37
- current = getNext(current, type);
13
+ while (current.toDate().getTime() <= startOfEnd.toDate().getTime()) {
14
+ results.push(current.toDate());
15
+ current = current.add(1, type);
38
16
  }
39
17
  return results;
40
18
  }
@@ -2,30 +2,30 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const get_each_1 = require("./get-each");
4
4
  test("getEach day", () => {
5
- expect((0, get_each_1.getEach)(new Date("2021-05-05T00:00:00+02:00"), new Date("2021-05-07T00:00:00+02:00"), "day").map((d) => d.toUTCString())).toStrictEqual([
6
- new Date("2021-05-05T00:00:00+02:00").toUTCString(),
7
- new Date("2021-05-06T00:00:00+02:00").toUTCString(),
8
- new Date("2021-05-07T00:00:00+02:00").toUTCString(),
5
+ expect((0, get_each_1.getEach)(new Date("2021-05-05"), new Date("2021-05-07"), "day")).toStrictEqual([
6
+ new Date("2021-05-05T00:00:00Z"),
7
+ new Date("2021-05-06T00:00:00Z"),
8
+ new Date("2021-05-07T00:00:00Z"),
9
9
  ]);
10
10
  });
11
11
  test("getEach month", () => {
12
- expect((0, get_each_1.getEach)(new Date("2021-05-05"), new Date("2021-08-07"), "month").map((d) => d.toUTCString())).toStrictEqual([
13
- new Date("2021-05-01T00:00:00+02:00").toUTCString(),
14
- new Date("2021-06-01T00:00:00+02:00").toUTCString(),
15
- new Date("2021-07-01T00:00:00+02:00").toUTCString(),
16
- new Date("2021-08-01T00:00:00+02:00").toUTCString(),
12
+ expect((0, get_each_1.getEach)(new Date("2021-05-05"), new Date("2021-08-07"), "month")).toStrictEqual([
13
+ new Date("2021-05-01T00:00:00Z"),
14
+ new Date("2021-06-01T00:00:00Z"),
15
+ new Date("2021-07-01T00:00:00Z"),
16
+ new Date("2021-08-01T00:00:00Z"),
17
17
  ]);
18
18
  });
19
19
  test("getEach year", () => {
20
- expect((0, get_each_1.getEach)(new Date("2015-05-05"), new Date("2020-05-07"), "year").map((d) => d.toUTCString())).toStrictEqual([
21
- new Date("2015-01-01T00:00:00+01:00").toUTCString(),
22
- new Date("2016-01-01T00:00:00+01:00").toUTCString(),
23
- new Date("2017-01-01T00:00:00+01:00").toUTCString(),
24
- new Date("2018-01-01T00:00:00+01:00").toUTCString(),
25
- new Date("2019-01-01T00:00:00+01:00").toUTCString(),
26
- new Date("2020-01-01T00:00:00+01:00").toUTCString(),
20
+ expect((0, get_each_1.getEach)(new Date("2015-05-05"), new Date("2020-05-07"), "year")).toStrictEqual([
21
+ new Date("2015-01-01T00:00:00Z"),
22
+ new Date("2016-01-01T00:00:00Z"),
23
+ new Date("2017-01-01T00:00:00Z"),
24
+ new Date("2018-01-01T00:00:00Z"),
25
+ new Date("2019-01-01T00:00:00Z"),
26
+ new Date("2020-01-01T00:00:00Z"),
27
27
  ]);
28
28
  });
29
29
  test("getEach invalid input", () => {
30
- expect(() => (0, get_each_1.getEach)(new Date("2015-05-05"), new Date("2014-05-07T00:00:00+02:00"), "day")).toThrow();
30
+ expect(() => (0, get_each_1.getEach)(new Date("2015-05-05"), new Date("2014-05-07T00:00:00Z"), "day")).toThrow();
31
31
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getInitialMonths = getInitialMonths;
4
- const dayjs_en_1 = require("./dayjs-en");
4
+ const dayjs_utils_1 = require("./dayjs-utils");
5
5
  const get_current_year_month_and_date_1 = require("./get-current-year-month-and-date");
6
6
  const get_date_month_and_year_1 = require("./get-date-month-and-year");
7
7
  function getInitialMonths(numberOfMonths, startDate) {
@@ -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_en_1.dayjsEn)(m[m.length - 1].date)
13
+ prevMonthDate = (0, dayjs_utils_1.dayjsEnRaw)(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)]);
@@ -4,7 +4,7 @@ const get_initial_months_1 = require("./get-initial-months");
4
4
  test("getInitialMonths", () => {
5
5
  expect((0, get_initial_months_1.getInitialMonths)(1, new Date("2021-09-15"))).toStrictEqual([
6
6
  {
7
- date: new Date("2021-09-01T00:00:00+02:00"),
7
+ date: new Date("2021-09-01T00:00:00Z"),
8
8
  month: 8,
9
9
  year: 2021,
10
10
  },
@@ -13,12 +13,12 @@ test("getInitialMonths", () => {
13
13
  test("getInitialMonths 2 months", () => {
14
14
  expect((0, get_initial_months_1.getInitialMonths)(2, new Date("2021-09-15"))).toStrictEqual([
15
15
  {
16
- date: new Date("2021-09-01T00:00:00+02:00"),
16
+ date: new Date("2021-09-01T00:00:00Z"),
17
17
  month: 8,
18
18
  year: 2021,
19
19
  },
20
20
  {
21
- date: new Date("2021-10-01T00:00:00+02:00"),
21
+ date: new Date("2021-10-01T00:00:00Z"),
22
22
  month: 9,
23
23
  year: 2021,
24
24
  },
@@ -29,7 +29,7 @@ test("getInitialMonths without date", () => {
29
29
  jest.setSystemTime(new Date("2021-09-15"));
30
30
  expect((0, get_initial_months_1.getInitialMonths)(1, null)).toStrictEqual([
31
31
  {
32
- date: new Date("2021-09-01T00:00:00+02:00"),
32
+ date: new Date("2021-09-01T00:00:00Z"),
33
33
  month: 8,
34
34
  year: 2021,
35
35
  },
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMonths = getMonths;
4
4
  const create_date_string_1 = require("./create-date-string");
5
- const dayjs_en_1 = require("./dayjs-en");
5
+ const dayjs_utils_1 = require("./dayjs-utils");
6
6
  const get_each_1 = require("./get-each");
7
- function getMonths({ year, monthLabelFormat = (date) => (0, dayjs_en_1.dayjsEn)(date).format("MMMM"), }) {
7
+ function getMonths({ year, monthLabelFormat = (date) => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("MMMM"), }) {
8
8
  const date = new Date((0, create_date_string_1.createDateString)(year, 0));
9
- const yearStart = (0, dayjs_en_1.dayjsEn)(date).startOf("year").toDate();
10
- const yearEnd = (0, dayjs_en_1.dayjsEn)(date).endOf("year").toDate();
9
+ const yearStart = (0, dayjs_utils_1.dayjsEnWithTz)(date).startOf("year").toDate();
10
+ const yearEnd = (0, dayjs_utils_1.dayjsEnWithTz)(date).endOf("year").toDate();
11
11
  return (0, get_each_1.getEach)(yearStart, yearEnd, "month").map((d) => ({
12
12
  date: d,
13
13
  monthLabel: monthLabelFormat(d),
@@ -1,39 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const dayjs_en_1 = require("./dayjs-en");
3
+ const dayjs_utils_1 = require("./dayjs-utils");
4
4
  const get_months_1 = require("./get-months");
5
5
  test("getMonths", () => {
6
- expect((0, get_months_1.getMonths)({ year: 2021 }).map((d) => ({ ...d, date: d.date.toUTCString() }))).toStrictEqual([
7
- { monthLabel: "January", date: new Date("2021-01-01T00:00:00+01:00").toUTCString() },
8
- { monthLabel: "February", date: new Date("2021-02-01T00:00:00+01:00").toUTCString() },
9
- { monthLabel: "March", date: new Date("2021-03-01T00:00:00+01:00").toUTCString() },
10
- { monthLabel: "April", date: new Date("2021-04-01T00:00:00+02:00").toUTCString() },
11
- { monthLabel: "May", date: new Date("2021-05-01T00:00:00+02:00").toUTCString() },
12
- { monthLabel: "June", date: new Date("2021-06-01T00:00:00+02:00").toUTCString() },
13
- { monthLabel: "July", date: new Date("2021-07-01T00:00:00+02:00").toUTCString() },
14
- { monthLabel: "August", date: new Date("2021-08-01T00:00:00+02:00").toUTCString() },
15
- { monthLabel: "September", date: new Date("2021-09-01T00:00:00+02:00").toUTCString() },
16
- { monthLabel: "October", date: new Date("2021-10-01T00:00:00+02:00").toUTCString() },
17
- { monthLabel: "November", date: new Date("2021-11-01T00:00:00+01:00").toUTCString() },
18
- { monthLabel: "December", date: new Date("2021-12-01T00:00:00+01:00").toUTCString() },
6
+ expect((0, get_months_1.getMonths)({ year: 2021 })).toStrictEqual([
7
+ { monthLabel: "January", date: new Date("2021-01-01T00:00:00Z") },
8
+ { monthLabel: "February", date: new Date("2021-02-01T00:00:00Z") },
9
+ { monthLabel: "March", date: new Date("2021-03-01T00:00:00Z") },
10
+ { monthLabel: "April", date: new Date("2021-04-01T00:00:00Z") },
11
+ { monthLabel: "May", date: new Date("2021-05-01T00:00:00Z") },
12
+ { monthLabel: "June", date: new Date("2021-06-01T00:00:00Z") },
13
+ { monthLabel: "July", date: new Date("2021-07-01T00:00:00Z") },
14
+ { monthLabel: "August", date: new Date("2021-08-01T00:00:00Z") },
15
+ { monthLabel: "September", date: new Date("2021-09-01T00:00:00Z") },
16
+ { monthLabel: "October", date: new Date("2021-10-01T00:00:00Z") },
17
+ { monthLabel: "November", date: new Date("2021-11-01T00:00:00Z") },
18
+ { monthLabel: "December", date: new Date("2021-12-01T00:00:00Z") },
19
19
  ]);
20
20
  });
21
21
  test("getMonths with custom format", () => {
22
- expect((0, get_months_1.getMonths)({ year: 2021, monthLabelFormat: (date) => (0, dayjs_en_1.dayjsEn)(date).format("MM") }).map((d) => ({
23
- ...d,
24
- date: d.date.toUTCString(),
25
- }))).toStrictEqual([
26
- { monthLabel: "01", date: new Date("2021-01-01T00:00:00+01:00").toUTCString() },
27
- { monthLabel: "02", date: new Date("2021-02-01T00:00:00+01:00").toUTCString() },
28
- { monthLabel: "03", date: new Date("2021-03-01T00:00:00+01:00").toUTCString() },
29
- { monthLabel: "04", date: new Date("2021-04-01T00:00:00+02:00").toUTCString() },
30
- { monthLabel: "05", date: new Date("2021-05-01T00:00:00+02:00").toUTCString() },
31
- { monthLabel: "06", date: new Date("2021-06-01T00:00:00+02:00").toUTCString() },
32
- { monthLabel: "07", date: new Date("2021-07-01T00:00:00+02:00").toUTCString() },
33
- { monthLabel: "08", date: new Date("2021-08-01T00:00:00+02:00").toUTCString() },
34
- { monthLabel: "09", date: new Date("2021-09-01T00:00:00+02:00").toUTCString() },
35
- { monthLabel: "10", date: new Date("2021-10-01T00:00:00+02:00").toUTCString() },
36
- { monthLabel: "11", date: new Date("2021-11-01T00:00:00+01:00").toUTCString() },
37
- { monthLabel: "12", date: new Date("2021-12-01T00:00:00+01:00").toUTCString() },
22
+ expect((0, get_months_1.getMonths)({ year: 2021, monthLabelFormat: (date) => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("MM") })).toStrictEqual([
23
+ { monthLabel: "01", date: new Date("2021-01-01T00:00:00Z") },
24
+ { monthLabel: "02", date: new Date("2021-02-01T00:00:00Z") },
25
+ { monthLabel: "03", date: new Date("2021-03-01T00:00:00Z") },
26
+ { monthLabel: "04", date: new Date("2021-04-01T00:00:00Z") },
27
+ { monthLabel: "05", date: new Date("2021-05-01T00:00:00Z") },
28
+ { monthLabel: "06", date: new Date("2021-06-01T00:00:00Z") },
29
+ { monthLabel: "07", date: new Date("2021-07-01T00:00:00Z") },
30
+ { monthLabel: "08", date: new Date("2021-08-01T00:00:00Z") },
31
+ { monthLabel: "09", date: new Date("2021-09-01T00:00:00Z") },
32
+ { monthLabel: "10", date: new Date("2021-10-01T00:00:00Z") },
33
+ { monthLabel: "11", date: new Date("2021-11-01T00:00:00Z") },
34
+ { monthLabel: "12", date: new Date("2021-12-01T00:00:00Z") },
38
35
  ]);
39
36
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNextActiveMonth = getNextActiveMonth;
4
- const dayjs_en_1 = require("./dayjs-en");
4
+ const dayjs_utils_1 = require("./dayjs-utils");
5
5
  const get_date_month_and_year_1 = require("./get-date-month-and-year");
6
6
  function getNextActiveMonth(activeMonth, numberOfMonths, counter, step) {
7
7
  let prevMonth;
@@ -14,10 +14,10 @@ function getNextActiveMonth(activeMonth, numberOfMonths, counter, step) {
14
14
  let prevMonthDate = activeMonth[prevMonth].date;
15
15
  return Array.from(Array(numberOfMonths).keys()).reduce((m) => {
16
16
  if (m.length === 0) {
17
- prevMonthDate = (0, dayjs_en_1.dayjsEn)(prevMonthDate).add(counter, "month").startOf("month").toDate();
17
+ prevMonthDate = (0, dayjs_utils_1.dayjsEnWithTz)(prevMonthDate).add(counter, "month").startOf("month").toDate();
18
18
  }
19
19
  else {
20
- prevMonthDate = (0, dayjs_en_1.dayjsEn)(prevMonthDate)
20
+ prevMonthDate = (0, dayjs_utils_1.dayjsEnWithTz)(prevMonthDate)
21
21
  .add(counter >= 0 ? 1 : -1, "month")
22
22
  .startOf("month")
23
23
  .toDate();