@pushwoosh/dumb-components 1.0.35 → 1.0.36
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.
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import { Spacing } from '@pushwoosh/kit-constants';
|
|
3
2
|
import { Columns } from '@pushwoosh/kit-helpers';
|
|
4
3
|
import { format, firstDayOfWeek, parseStringToDate, differenceInDays, isSamePeriod, isInRange } from '../../helpers';
|
|
5
4
|
import { CellBox, DayHeader } from '../../styles';
|
|
@@ -26,11 +25,11 @@ export function Month(props) {
|
|
|
26
25
|
}, [month]);
|
|
27
26
|
return React.createElement(Columns, {
|
|
28
27
|
"$sizes": 7,
|
|
29
|
-
"$gap":
|
|
28
|
+
"$gap": 4
|
|
30
29
|
}, React.createElement(DayHeader, null, "Sun"), React.createElement(DayHeader, null, "Mon"), React.createElement(DayHeader, null, "Tue"), React.createElement(DayHeader, null, "Wed"), React.createElement(DayHeader, null, "Thu"), React.createElement(DayHeader, null, "Fri"), React.createElement(DayHeader, null, "Sat"), Array.from({
|
|
31
30
|
length: days
|
|
32
31
|
}).map((_, i) => {
|
|
33
|
-
const curDay = new Date(firstDayDate.getUTCFullYear(), firstDayDate.getUTCMonth(), firstDayDate.getUTCDate() + i);
|
|
32
|
+
const curDay = new Date(Date.UTC(firstDayDate.getUTCFullYear(), firstDayDate.getUTCMonth(), firstDayDate.getUTCDate() + i));
|
|
34
33
|
const isDisabled = isInRange({
|
|
35
34
|
value: curDay,
|
|
36
35
|
minDate: minDate || undefined,
|
|
@@ -52,8 +52,9 @@ export const isSamePeriod = (d1, d2, period) => {
|
|
|
52
52
|
export const firstDayOfWeek = date => {
|
|
53
53
|
const d = new Date(date);
|
|
54
54
|
const day = d.getUTCDay();
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
if (day > 0) {
|
|
56
|
+
d.setUTCDate(d.getUTCDate() - day);
|
|
57
|
+
}
|
|
57
58
|
return d;
|
|
58
59
|
};
|
|
59
60
|
export const startOfYear = date => new Date(date.getFullYear(), 0, 1, 0, 0, 0, 0);
|