@semcore/date-picker 2.6.0 → 2.7.0-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/lib/cjs/DatePicker.js.map +1 -1
- package/lib/cjs/DateRangePicker.js.map +1 -1
- package/lib/cjs/MonthPicker.js.map +1 -1
- package/lib/cjs/MonthRangePicker.js.map +1 -1
- package/lib/cjs/components/Calendar.js +16 -16
- package/lib/cjs/components/Calendar.js.map +1 -1
- package/lib/cjs/components/PickerAbstract.js +6 -6
- package/lib/cjs/components/PickerAbstract.js.map +1 -1
- package/lib/cjs/components/RangePickerAbstract.js +6 -6
- package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
- package/lib/cjs/components/index.js +2 -2
- package/lib/es6/DatePicker.js.map +1 -1
- package/lib/es6/DateRangePicker.js.map +1 -1
- package/lib/es6/MonthPicker.js.map +1 -1
- package/lib/es6/MonthRangePicker.js.map +1 -1
- package/lib/es6/components/Calendar.js +16 -16
- package/lib/es6/components/Calendar.js.map +1 -1
- package/lib/es6/components/PickerAbstract.js +6 -6
- package/lib/es6/components/PickerAbstract.js.map +1 -1
- package/lib/es6/components/RangePickerAbstract.js +6 -6
- package/lib/es6/components/RangePickerAbstract.js.map +1 -1
- package/lib/es6/components/index.js +2 -2
- package/package.json +3 -3
- package/src/DatePicker.js +1 -3
- package/src/DateRangePicker.js +5 -30
- package/src/MonthPicker.js +1 -3
- package/src/MonthRangePicker.js +9 -32
- package/src/components/Calendar.js +1 -3
- package/src/components/PickerAbstract.js +3 -9
- package/src/components/RangePickerAbstract.js +5 -18
package/src/MonthPicker.js
CHANGED
|
@@ -46,9 +46,7 @@ class MonthPickerRoot extends PickerAbstract {
|
|
|
46
46
|
return {
|
|
47
47
|
...super.getTitleProps(),
|
|
48
48
|
children: new Intl.DateTimeFormat(locale, { year: 'numeric' }).format(
|
|
49
|
-
dayjs(displayedPeriod)
|
|
50
|
-
.startOf('year')
|
|
51
|
-
.toDate(),
|
|
49
|
+
dayjs(displayedPeriod).startOf('year').toDate(),
|
|
52
50
|
),
|
|
53
51
|
};
|
|
54
52
|
}
|
package/src/MonthRangePicker.js
CHANGED
|
@@ -36,49 +36,29 @@ class MonthRangePickerRoot extends RangePickerAbstract {
|
|
|
36
36
|
{
|
|
37
37
|
children: getI18nText('lastMonth'),
|
|
38
38
|
value: [
|
|
39
|
-
dayjs(today)
|
|
40
|
-
|
|
41
|
-
.startOf('month')
|
|
42
|
-
.toDate(),
|
|
43
|
-
dayjs(today)
|
|
44
|
-
.startOf('month')
|
|
45
|
-
.toDate(),
|
|
39
|
+
dayjs(today).subtract(1, 'month').startOf('month').toDate(),
|
|
40
|
+
dayjs(today).startOf('month').toDate(),
|
|
46
41
|
],
|
|
47
42
|
},
|
|
48
43
|
{
|
|
49
44
|
children: getI18nText('last3Months'),
|
|
50
45
|
value: [
|
|
51
|
-
dayjs(today)
|
|
52
|
-
|
|
53
|
-
.startOf('month')
|
|
54
|
-
.toDate(),
|
|
55
|
-
dayjs(today)
|
|
56
|
-
.startOf('month')
|
|
57
|
-
.toDate(),
|
|
46
|
+
dayjs(today).subtract(2, 'month').startOf('month').toDate(),
|
|
47
|
+
dayjs(today).startOf('month').toDate(),
|
|
58
48
|
],
|
|
59
49
|
},
|
|
60
50
|
{
|
|
61
51
|
children: getI18nText('last6Months'),
|
|
62
52
|
value: [
|
|
63
|
-
dayjs(today)
|
|
64
|
-
|
|
65
|
-
.startOf('month')
|
|
66
|
-
.toDate(),
|
|
67
|
-
dayjs(today)
|
|
68
|
-
.startOf('month')
|
|
69
|
-
.toDate(),
|
|
53
|
+
dayjs(today).subtract(5, 'month').startOf('month').toDate(),
|
|
54
|
+
dayjs(today).startOf('month').toDate(),
|
|
70
55
|
],
|
|
71
56
|
},
|
|
72
57
|
{
|
|
73
58
|
children: getI18nText('last12Months'),
|
|
74
59
|
value: [
|
|
75
|
-
dayjs(today)
|
|
76
|
-
|
|
77
|
-
.startOf('month')
|
|
78
|
-
.toDate(),
|
|
79
|
-
dayjs(today)
|
|
80
|
-
.startOf('month')
|
|
81
|
-
.toDate(),
|
|
60
|
+
dayjs(today).subtract(11, 'month').startOf('month').toDate(),
|
|
61
|
+
dayjs(today).startOf('month').toDate(),
|
|
82
62
|
],
|
|
83
63
|
},
|
|
84
64
|
];
|
|
@@ -102,10 +82,7 @@ class MonthRangePickerRoot extends RangePickerAbstract {
|
|
|
102
82
|
return {
|
|
103
83
|
...super.getTitleProps(props, index),
|
|
104
84
|
children: new Intl.DateTimeFormat(locale, { year: 'numeric' }).format(
|
|
105
|
-
dayjs(displayedPeriod)
|
|
106
|
-
.add(index, this.navigateStep)
|
|
107
|
-
.startOf(this.navigateStep)
|
|
108
|
-
.toDate(),
|
|
85
|
+
dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate(),
|
|
109
86
|
),
|
|
110
87
|
};
|
|
111
88
|
}
|
|
@@ -37,9 +37,7 @@ class CalendarWeekDaysRoot extends Component {
|
|
|
37
37
|
getDaysByWeek() {
|
|
38
38
|
const { locale } = this.asProps;
|
|
39
39
|
|
|
40
|
-
let date = dayjs()
|
|
41
|
-
.locale(locale, getDayJSLocaleParams(locale))
|
|
42
|
-
.startOf('week');
|
|
40
|
+
let date = dayjs().locale(locale, getDayJSLocaleParams(locale)).startOf('week');
|
|
43
41
|
return range(7, () => {
|
|
44
42
|
const weekday = new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(date.valueOf());
|
|
45
43
|
date = date.add(1, 'day');
|
|
@@ -42,15 +42,11 @@ class PickerAbstract extends Component {
|
|
|
42
42
|
static enhance = [i18nEnhance()];
|
|
43
43
|
|
|
44
44
|
static add = (date, amount, unit) => {
|
|
45
|
-
return dayjs(date)
|
|
46
|
-
.add(amount, unit)
|
|
47
|
-
.toDate();
|
|
45
|
+
return dayjs(date).add(amount, unit).toDate();
|
|
48
46
|
};
|
|
49
47
|
|
|
50
48
|
static subtract = (date, amount, unit) => {
|
|
51
|
-
return dayjs(date)
|
|
52
|
-
.subtract(amount, unit)
|
|
53
|
-
.toDate();
|
|
49
|
+
return dayjs(date).subtract(amount, unit).toDate();
|
|
54
50
|
};
|
|
55
51
|
|
|
56
52
|
navigateStep;
|
|
@@ -84,9 +80,7 @@ class PickerAbstract extends Component {
|
|
|
84
80
|
navigateView = (direction) => {
|
|
85
81
|
const { displayedPeriod } = this.asProps;
|
|
86
82
|
const action = direction >= 1 ? 'add' : 'subtract';
|
|
87
|
-
const date = dayjs(displayedPeriod)
|
|
88
|
-
[action](1, this.navigateStep)
|
|
89
|
-
.toDate();
|
|
83
|
+
const date = dayjs(displayedPeriod)[action](1, this.navigateStep).toDate();
|
|
90
84
|
this.handlers.displayedPeriod(date);
|
|
91
85
|
};
|
|
92
86
|
|
|
@@ -51,15 +51,11 @@ class RangePickerAbstract extends Component {
|
|
|
51
51
|
static enhance = [i18nEnhance()];
|
|
52
52
|
|
|
53
53
|
static add = (date, amount, unit) => {
|
|
54
|
-
return dayjs(date)
|
|
55
|
-
.add(amount, unit)
|
|
56
|
-
.toDate();
|
|
54
|
+
return dayjs(date).add(amount, unit).toDate();
|
|
57
55
|
};
|
|
58
56
|
|
|
59
57
|
static subtract = (date, amount, unit) => {
|
|
60
|
-
return dayjs(date)
|
|
61
|
-
.subtract(amount, unit)
|
|
62
|
-
.toDate();
|
|
58
|
+
return dayjs(date).subtract(amount, unit).toDate();
|
|
63
59
|
};
|
|
64
60
|
|
|
65
61
|
navigateStep;
|
|
@@ -100,9 +96,7 @@ class RangePickerAbstract extends Component {
|
|
|
100
96
|
navigateView = (direction) => {
|
|
101
97
|
const { displayedPeriod } = this.asProps;
|
|
102
98
|
const action = direction >= 1 ? 'add' : 'subtract';
|
|
103
|
-
const date = dayjs(displayedPeriod)
|
|
104
|
-
[action](1, this.navigateStep)
|
|
105
|
-
.toDate();
|
|
99
|
+
const date = dayjs(displayedPeriod)[action](1, this.navigateStep).toDate();
|
|
106
100
|
this.handlers.displayedPeriod(date);
|
|
107
101
|
};
|
|
108
102
|
|
|
@@ -145,11 +139,7 @@ class RangePickerAbstract extends Component {
|
|
|
145
139
|
.toDate(),
|
|
146
140
|
];
|
|
147
141
|
} else {
|
|
148
|
-
next_highlighted = [
|
|
149
|
-
dayjs(highlighted[0])
|
|
150
|
-
.add(day, this.keyStep)
|
|
151
|
-
.toDate(),
|
|
152
|
-
];
|
|
142
|
+
next_highlighted = [dayjs(highlighted[0]).add(day, this.keyStep).toDate()];
|
|
153
143
|
}
|
|
154
144
|
this.handlers.highlighted(next_highlighted);
|
|
155
145
|
this.handlers.displayedPeriod(setNextDisplayedPeriod(next_highlighted));
|
|
@@ -284,10 +274,7 @@ class RangePickerAbstract extends Component {
|
|
|
284
274
|
const { locale, displayedPeriod } = this.asProps;
|
|
285
275
|
return {
|
|
286
276
|
children: new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' }).format(
|
|
287
|
-
dayjs(displayedPeriod)
|
|
288
|
-
.add(index, this.navigateStep)
|
|
289
|
-
.startOf(this.navigateStep)
|
|
290
|
-
.toDate(),
|
|
277
|
+
dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate(),
|
|
291
278
|
),
|
|
292
279
|
};
|
|
293
280
|
}
|