@mui/x-date-pickers 6.18.7 → 6.19.2
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/AdapterDateFns/AdapterDateFns.d.ts +4 -24
- package/AdapterDateFns/AdapterDateFns.js +11 -272
- package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +65 -0
- package/AdapterDateFnsBase/AdapterDateFnsBase.js +308 -0
- package/AdapterDateFnsBase/index.d.ts +1 -0
- package/AdapterDateFnsBase/index.js +1 -0
- package/AdapterDateFnsBase/package.json +6 -0
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -0
- package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +88 -0
- package/AdapterDateFnsV3/AdapterDateFnsV3.js +358 -0
- package/AdapterDateFnsV3/index.d.ts +1 -0
- package/AdapterDateFnsV3/index.js +1 -0
- package/AdapterDateFnsV3/package.json +6 -0
- package/AdapterLuxon/AdapterLuxon.js +0 -1
- package/CHANGELOG.md +106 -0
- package/DateCalendar/useCalendarState.js +0 -1
- package/DatePicker/DatePickerToolbar.d.ts +2 -2
- package/DatePicker/DatePickerToolbar.js +2 -7
- package/DateTimePicker/DateTimePickerTabs.js +6 -3
- package/DigitalClock/DigitalClock.js +1 -0
- package/DigitalClock/DigitalClock.types.d.ts +5 -0
- package/MonthCalendar/MonthCalendar.js +0 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +5 -0
- package/PickersLayout/pickersLayoutClasses.js +3 -2
- package/PickersLayout/usePickerLayout.js +2 -1
- package/TimeClock/Clock.js +0 -1
- package/TimeClock/ClockPointer.js +0 -1
- package/TimeClock/TimeClock.js +1 -0
- package/TimeClock/TimeClock.types.d.ts +5 -0
- package/YearCalendar/YearCalendar.js +0 -1
- package/hooks/useClearableField.d.ts +1 -1
- package/hooks/useClearableField.js +3 -3
- package/index.js +1 -1
- package/internals/hooks/useClockReferenceDate.js +0 -1
- package/internals/hooks/useField/useField.utils.js +0 -2
- package/internals/hooks/useViews.js +0 -1
- package/internals/models/helpers.d.ts +1 -0
- package/internals/models/props/tabs.d.ts +1 -0
- package/legacy/AdapterDateFns/AdapterDateFns.js +278 -529
- package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +308 -0
- package/legacy/AdapterDateFnsBase/index.js +1 -0
- package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +376 -0
- package/legacy/AdapterDateFnsV3/index.js +1 -0
- package/legacy/AdapterLuxon/AdapterLuxon.js +0 -1
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -6
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -6
- package/legacy/DateCalendar/PickersSlideTransition.js +8 -9
- package/legacy/DateCalendar/useCalendarState.js +0 -1
- package/legacy/DatePicker/DatePickerToolbar.js +2 -7
- package/legacy/DateTimePicker/DateTimePickerTabs.js +6 -3
- package/legacy/DigitalClock/DigitalClock.js +1 -0
- package/legacy/MonthCalendar/MonthCalendar.js +0 -1
- package/legacy/MonthCalendar/PickersMonth.js +4 -5
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/legacy/PickersDay/PickersDay.js +5 -6
- package/legacy/PickersLayout/PickersLayout.js +5 -6
- package/legacy/PickersLayout/pickersLayoutClasses.js +3 -2
- package/legacy/PickersLayout/usePickerLayout.js +2 -1
- package/legacy/TimeClock/Clock.js +0 -1
- package/legacy/TimeClock/ClockNumber.js +4 -5
- package/legacy/TimeClock/ClockPointer.js +0 -1
- package/legacy/TimeClock/TimeClock.js +1 -0
- package/legacy/TimePicker/TimePickerToolbar.js +1 -2
- package/legacy/YearCalendar/PickersYear.js +4 -5
- package/legacy/YearCalendar/YearCalendar.js +0 -1
- package/legacy/hooks/useClearableField.js +3 -3
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersModalDialog.js +3 -4
- package/legacy/internals/hooks/useClockReferenceDate.js +0 -1
- package/legacy/internals/hooks/useField/useField.utils.js +0 -2
- package/legacy/internals/hooks/useViews.js +0 -1
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/plPL.js +0 -1
- package/legacy/locales/svSE.js +0 -1
- package/legacy/locales/urPK.js +0 -1
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/plPL.js +0 -1
- package/locales/svSE.js +0 -1
- package/locales/urPK.js +0 -1
- package/modern/AdapterDateFns/AdapterDateFns.js +11 -271
- package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +307 -0
- package/modern/AdapterDateFnsBase/index.js +1 -0
- package/modern/AdapterDateFnsV3/AdapterDateFnsV3.js +358 -0
- package/modern/AdapterDateFnsV3/index.js +1 -0
- package/modern/AdapterLuxon/AdapterLuxon.js +0 -1
- package/modern/DateCalendar/useCalendarState.js +0 -1
- package/modern/DatePicker/DatePickerToolbar.js +2 -7
- package/modern/DateTimePicker/DateTimePickerTabs.js +6 -3
- package/modern/DigitalClock/DigitalClock.js +1 -0
- package/modern/MonthCalendar/MonthCalendar.js +0 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/modern/PickersLayout/pickersLayoutClasses.js +3 -2
- package/modern/PickersLayout/usePickerLayout.js +2 -1
- package/modern/TimeClock/Clock.js +0 -1
- package/modern/TimeClock/ClockPointer.js +0 -1
- package/modern/TimeClock/TimeClock.js +1 -0
- package/modern/YearCalendar/YearCalendar.js +0 -1
- package/modern/hooks/useClearableField.js +3 -3
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useClockReferenceDate.js +0 -1
- package/modern/internals/hooks/useField/useField.utils.js +0 -2
- package/modern/internals/hooks/useViews.js +0 -1
- package/modern/locales/index.js +1 -0
- package/modern/locales/plPL.js +0 -1
- package/modern/locales/svSE.js +0 -1
- package/modern/locales/urPK.js +0 -1
- package/node/AdapterDateFns/AdapterDateFns.js +11 -271
- package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +315 -0
- package/node/AdapterDateFnsBase/index.js +12 -0
- package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +366 -0
- package/node/AdapterDateFnsV3/index.js +12 -0
- package/node/AdapterLuxon/AdapterLuxon.js +0 -1
- package/node/DateCalendar/useCalendarState.js +0 -1
- package/node/DatePicker/DatePickerToolbar.js +0 -4
- package/node/DateTimePicker/DateTimePickerTabs.js +7 -4
- package/node/DigitalClock/DigitalClock.js +1 -0
- package/node/MonthCalendar/MonthCalendar.js +0 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/node/PickersLayout/pickersLayoutClasses.js +5 -3
- package/node/PickersLayout/usePickerLayout.js +2 -1
- package/node/TimeClock/Clock.js +0 -1
- package/node/TimeClock/ClockPointer.js +0 -1
- package/node/TimeClock/TimeClock.js +1 -0
- package/node/YearCalendar/YearCalendar.js +0 -1
- package/node/hooks/useClearableField.js +3 -3
- package/node/index.js +1 -1
- package/node/internals/hooks/useClockReferenceDate.js +0 -1
- package/node/internals/hooks/useField/useField.utils.js +0 -2
- package/node/internals/hooks/useViews.js +0 -1
- package/node/locales/index.js +11 -0
- package/node/locales/plPL.js +0 -1
- package/node/locales/svSE.js +0 -1
- package/node/locales/urPK.js +0 -1
- package/package.json +2 -2
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
5
9
|
/* eslint-disable class-methods-use-this */
|
|
6
10
|
import addDays from 'date-fns/addDays';
|
|
7
11
|
import addSeconds from 'date-fns/addSeconds';
|
|
@@ -60,202 +64,7 @@ import isWithinInterval from 'date-fns/isWithinInterval';
|
|
|
60
64
|
import defaultLocale from 'date-fns/locale/en-US';
|
|
61
65
|
// @ts-ignore
|
|
62
66
|
import longFormatters from 'date-fns/_lib/format/longFormatters';
|
|
63
|
-
|
|
64
|
-
// Year
|
|
65
|
-
y: {
|
|
66
|
-
sectionType: 'year',
|
|
67
|
-
contentType: 'digit',
|
|
68
|
-
maxLength: 4
|
|
69
|
-
},
|
|
70
|
-
yy: 'year',
|
|
71
|
-
yyy: {
|
|
72
|
-
sectionType: 'year',
|
|
73
|
-
contentType: 'digit',
|
|
74
|
-
maxLength: 4
|
|
75
|
-
},
|
|
76
|
-
yyyy: 'year',
|
|
77
|
-
// Month
|
|
78
|
-
M: {
|
|
79
|
-
sectionType: 'month',
|
|
80
|
-
contentType: 'digit',
|
|
81
|
-
maxLength: 2
|
|
82
|
-
},
|
|
83
|
-
MM: 'month',
|
|
84
|
-
MMMM: {
|
|
85
|
-
sectionType: 'month',
|
|
86
|
-
contentType: 'letter'
|
|
87
|
-
},
|
|
88
|
-
MMM: {
|
|
89
|
-
sectionType: 'month',
|
|
90
|
-
contentType: 'letter'
|
|
91
|
-
},
|
|
92
|
-
L: {
|
|
93
|
-
sectionType: 'month',
|
|
94
|
-
contentType: 'digit',
|
|
95
|
-
maxLength: 2
|
|
96
|
-
},
|
|
97
|
-
LL: 'month',
|
|
98
|
-
LLL: {
|
|
99
|
-
sectionType: 'month',
|
|
100
|
-
contentType: 'letter'
|
|
101
|
-
},
|
|
102
|
-
LLLL: {
|
|
103
|
-
sectionType: 'month',
|
|
104
|
-
contentType: 'letter'
|
|
105
|
-
},
|
|
106
|
-
// Day of the month
|
|
107
|
-
d: {
|
|
108
|
-
sectionType: 'day',
|
|
109
|
-
contentType: 'digit',
|
|
110
|
-
maxLength: 2
|
|
111
|
-
},
|
|
112
|
-
dd: 'day',
|
|
113
|
-
do: {
|
|
114
|
-
sectionType: 'day',
|
|
115
|
-
contentType: 'digit-with-letter'
|
|
116
|
-
},
|
|
117
|
-
// Day of the week
|
|
118
|
-
E: {
|
|
119
|
-
sectionType: 'weekDay',
|
|
120
|
-
contentType: 'letter'
|
|
121
|
-
},
|
|
122
|
-
EE: {
|
|
123
|
-
sectionType: 'weekDay',
|
|
124
|
-
contentType: 'letter'
|
|
125
|
-
},
|
|
126
|
-
EEE: {
|
|
127
|
-
sectionType: 'weekDay',
|
|
128
|
-
contentType: 'letter'
|
|
129
|
-
},
|
|
130
|
-
EEEE: {
|
|
131
|
-
sectionType: 'weekDay',
|
|
132
|
-
contentType: 'letter'
|
|
133
|
-
},
|
|
134
|
-
EEEEE: {
|
|
135
|
-
sectionType: 'weekDay',
|
|
136
|
-
contentType: 'letter'
|
|
137
|
-
},
|
|
138
|
-
i: {
|
|
139
|
-
sectionType: 'weekDay',
|
|
140
|
-
contentType: 'digit',
|
|
141
|
-
maxLength: 1
|
|
142
|
-
},
|
|
143
|
-
ii: 'weekDay',
|
|
144
|
-
iii: {
|
|
145
|
-
sectionType: 'weekDay',
|
|
146
|
-
contentType: 'letter'
|
|
147
|
-
},
|
|
148
|
-
iiii: {
|
|
149
|
-
sectionType: 'weekDay',
|
|
150
|
-
contentType: 'letter'
|
|
151
|
-
},
|
|
152
|
-
e: {
|
|
153
|
-
sectionType: 'weekDay',
|
|
154
|
-
contentType: 'digit',
|
|
155
|
-
maxLength: 1
|
|
156
|
-
},
|
|
157
|
-
ee: 'weekDay',
|
|
158
|
-
eee: {
|
|
159
|
-
sectionType: 'weekDay',
|
|
160
|
-
contentType: 'letter'
|
|
161
|
-
},
|
|
162
|
-
eeee: {
|
|
163
|
-
sectionType: 'weekDay',
|
|
164
|
-
contentType: 'letter'
|
|
165
|
-
},
|
|
166
|
-
eeeee: {
|
|
167
|
-
sectionType: 'weekDay',
|
|
168
|
-
contentType: 'letter'
|
|
169
|
-
},
|
|
170
|
-
eeeeee: {
|
|
171
|
-
sectionType: 'weekDay',
|
|
172
|
-
contentType: 'letter'
|
|
173
|
-
},
|
|
174
|
-
c: {
|
|
175
|
-
sectionType: 'weekDay',
|
|
176
|
-
contentType: 'digit',
|
|
177
|
-
maxLength: 1
|
|
178
|
-
},
|
|
179
|
-
cc: 'weekDay',
|
|
180
|
-
ccc: {
|
|
181
|
-
sectionType: 'weekDay',
|
|
182
|
-
contentType: 'letter'
|
|
183
|
-
},
|
|
184
|
-
cccc: {
|
|
185
|
-
sectionType: 'weekDay',
|
|
186
|
-
contentType: 'letter'
|
|
187
|
-
},
|
|
188
|
-
ccccc: {
|
|
189
|
-
sectionType: 'weekDay',
|
|
190
|
-
contentType: 'letter'
|
|
191
|
-
},
|
|
192
|
-
cccccc: {
|
|
193
|
-
sectionType: 'weekDay',
|
|
194
|
-
contentType: 'letter'
|
|
195
|
-
},
|
|
196
|
-
// Meridiem
|
|
197
|
-
a: 'meridiem',
|
|
198
|
-
aa: 'meridiem',
|
|
199
|
-
aaa: 'meridiem',
|
|
200
|
-
// Hours
|
|
201
|
-
H: {
|
|
202
|
-
sectionType: 'hours',
|
|
203
|
-
contentType: 'digit',
|
|
204
|
-
maxLength: 2
|
|
205
|
-
},
|
|
206
|
-
HH: 'hours',
|
|
207
|
-
h: {
|
|
208
|
-
sectionType: 'hours',
|
|
209
|
-
contentType: 'digit',
|
|
210
|
-
maxLength: 2
|
|
211
|
-
},
|
|
212
|
-
hh: 'hours',
|
|
213
|
-
// Minutes
|
|
214
|
-
m: {
|
|
215
|
-
sectionType: 'minutes',
|
|
216
|
-
contentType: 'digit',
|
|
217
|
-
maxLength: 2
|
|
218
|
-
},
|
|
219
|
-
mm: 'minutes',
|
|
220
|
-
// Seconds
|
|
221
|
-
s: {
|
|
222
|
-
sectionType: 'seconds',
|
|
223
|
-
contentType: 'digit',
|
|
224
|
-
maxLength: 2
|
|
225
|
-
},
|
|
226
|
-
ss: 'seconds'
|
|
227
|
-
};
|
|
228
|
-
var defaultFormats = {
|
|
229
|
-
year: 'yyyy',
|
|
230
|
-
month: 'LLLL',
|
|
231
|
-
monthShort: 'MMM',
|
|
232
|
-
dayOfMonth: 'd',
|
|
233
|
-
weekday: 'EEEE',
|
|
234
|
-
weekdayShort: 'EEEEEE',
|
|
235
|
-
hours24h: 'HH',
|
|
236
|
-
hours12h: 'hh',
|
|
237
|
-
meridiem: 'aa',
|
|
238
|
-
minutes: 'mm',
|
|
239
|
-
seconds: 'ss',
|
|
240
|
-
fullDate: 'PP',
|
|
241
|
-
fullDateWithWeekday: 'PPPP',
|
|
242
|
-
keyboardDate: 'P',
|
|
243
|
-
shortDate: 'MMM d',
|
|
244
|
-
normalDate: 'd MMMM',
|
|
245
|
-
normalDateWithWeekday: 'EEE, MMM d',
|
|
246
|
-
monthAndYear: 'LLLL yyyy',
|
|
247
|
-
monthAndDate: 'MMMM d',
|
|
248
|
-
fullTime: 'p',
|
|
249
|
-
fullTime12h: 'hh:mm aa',
|
|
250
|
-
fullTime24h: 'HH:mm',
|
|
251
|
-
fullDateTime: 'PP p',
|
|
252
|
-
fullDateTime12h: 'PP hh:mm aa',
|
|
253
|
-
fullDateTime24h: 'PP HH:mm',
|
|
254
|
-
keyboardDateTime: 'P p',
|
|
255
|
-
keyboardDateTime12h: 'P hh:mm aa',
|
|
256
|
-
keyboardDateTime24h: 'P HH:mm'
|
|
257
|
-
};
|
|
258
|
-
|
|
67
|
+
import { AdapterDateFnsBase } from '../AdapterDateFnsBase';
|
|
259
68
|
/**
|
|
260
69
|
* Based on `@date-io/date-fns`
|
|
261
70
|
*
|
|
@@ -281,339 +90,279 @@ var defaultFormats = {
|
|
|
281
90
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
282
91
|
* SOFTWARE.
|
|
283
92
|
*/
|
|
284
|
-
export var AdapterDateFns = /*#__PURE__*/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
this.formats = void 0;
|
|
295
|
-
this.formatTokenMap = formatTokenMap;
|
|
296
|
-
this.escapedCharacters = {
|
|
297
|
-
start: "'",
|
|
298
|
-
end: "'"
|
|
299
|
-
};
|
|
300
|
-
this.date = function (value) {
|
|
301
|
-
if (typeof value === 'undefined') {
|
|
302
|
-
return new Date();
|
|
93
|
+
export var AdapterDateFns = /*#__PURE__*/function (_ref) {
|
|
94
|
+
_inherits(AdapterDateFns, _ref);
|
|
95
|
+
function AdapterDateFns() {
|
|
96
|
+
var _this;
|
|
97
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
98
|
+
locale = _ref2.locale,
|
|
99
|
+
formats = _ref2.formats;
|
|
100
|
+
_classCallCheck(this, AdapterDateFns);
|
|
101
|
+
if (typeof addDays !== 'function') {
|
|
102
|
+
throw new Error(['MUI: The `date-fns` package v3.x is not compatible with this adapter.', 'Please, install v2.x of the package or use the `AdapterDateFnsV3` instead.'].join('\n'));
|
|
303
103
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
};
|
|
321
|
-
this.parseISO = function (isoString) {
|
|
322
|
-
return parseISO(isoString);
|
|
323
|
-
};
|
|
324
|
-
this.toISO = function (value) {
|
|
325
|
-
return formatISO(value, {
|
|
326
|
-
format: 'extended'
|
|
327
|
-
});
|
|
328
|
-
};
|
|
329
|
-
this.parse = function (value, format) {
|
|
330
|
-
if (value === '') {
|
|
331
|
-
return null;
|
|
332
|
-
}
|
|
333
|
-
return dateFnsParse(value, format, new Date(), {
|
|
334
|
-
locale: _this.locale
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
|
-
this.getCurrentLocaleCode = function () {
|
|
338
|
-
var _this$locale;
|
|
339
|
-
return ((_this$locale = _this.locale) == null ? void 0 : _this$locale.code) || 'en-US';
|
|
340
|
-
};
|
|
341
|
-
// Note: date-fns input types are more lenient than this adapter, so we need to expose our more
|
|
342
|
-
// strict signature and delegate to the more lenient signature. Otherwise, we have downstream type errors upon usage.
|
|
343
|
-
this.is12HourCycleInCurrentLocale = function () {
|
|
344
|
-
if (_this.locale) {
|
|
345
|
-
return /a/.test(_this.locale.formatLong.time());
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// By default, date-fns is using en-US locale with am/pm enabled
|
|
349
|
-
return true;
|
|
350
|
-
};
|
|
351
|
-
this.expandFormat = function (format) {
|
|
352
|
-
var longFormatRegexp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
353
|
-
|
|
354
|
-
// @see https://github.com/date-fns/date-fns/blob/master/src/format/index.js#L31
|
|
355
|
-
return format.match(longFormatRegexp).map(function (token) {
|
|
356
|
-
var firstCharacter = token[0];
|
|
357
|
-
if (firstCharacter === 'p' || firstCharacter === 'P') {
|
|
358
|
-
var longFormatter = longFormatters[firstCharacter];
|
|
359
|
-
var locale = _this.locale || defaultLocale;
|
|
360
|
-
return longFormatter(token, locale.formatLong, {});
|
|
104
|
+
_this = _callSuper(this, AdapterDateFns, [{
|
|
105
|
+
locale: locale != null ? locale : defaultLocale,
|
|
106
|
+
formats: formats,
|
|
107
|
+
longFormatters: longFormatters
|
|
108
|
+
}]);
|
|
109
|
+
_this.parseISO = function (isoString) {
|
|
110
|
+
return parseISO(isoString);
|
|
111
|
+
};
|
|
112
|
+
_this.toISO = function (value) {
|
|
113
|
+
return formatISO(value, {
|
|
114
|
+
format: 'extended'
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
_this.parse = function (value, format) {
|
|
118
|
+
if (value === '') {
|
|
119
|
+
return null;
|
|
361
120
|
}
|
|
362
|
-
return
|
|
363
|
-
}).join('');
|
|
364
|
-
};
|
|
365
|
-
this.getFormatHelperText = function (format) {
|
|
366
|
-
return _this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
|
|
367
|
-
};
|
|
368
|
-
this.isNull = function (value) {
|
|
369
|
-
return value === null;
|
|
370
|
-
};
|
|
371
|
-
this.isValid = function (value) {
|
|
372
|
-
return isValid(_this.date(value));
|
|
373
|
-
};
|
|
374
|
-
this.format = function (value, formatKey) {
|
|
375
|
-
return _this.formatByString(value, _this.formats[formatKey]);
|
|
376
|
-
};
|
|
377
|
-
this.formatByString = function (value, formatString) {
|
|
378
|
-
return dateFnsFormat(value, formatString, {
|
|
379
|
-
locale: _this.locale
|
|
380
|
-
});
|
|
381
|
-
};
|
|
382
|
-
this.formatNumber = function (numberToFormat) {
|
|
383
|
-
return numberToFormat;
|
|
384
|
-
};
|
|
385
|
-
this.getDiff = function (value, comparing, unit) {
|
|
386
|
-
switch (unit) {
|
|
387
|
-
case 'years':
|
|
388
|
-
return differenceInYears(value, _this.date(comparing));
|
|
389
|
-
case 'quarters':
|
|
390
|
-
return differenceInQuarters(value, _this.date(comparing));
|
|
391
|
-
case 'months':
|
|
392
|
-
return differenceInMonths(value, _this.date(comparing));
|
|
393
|
-
case 'weeks':
|
|
394
|
-
return differenceInWeeks(value, _this.date(comparing));
|
|
395
|
-
case 'days':
|
|
396
|
-
return differenceInDays(value, _this.date(comparing));
|
|
397
|
-
case 'hours':
|
|
398
|
-
return differenceInHours(value, _this.date(comparing));
|
|
399
|
-
case 'minutes':
|
|
400
|
-
return differenceInMinutes(value, _this.date(comparing));
|
|
401
|
-
case 'seconds':
|
|
402
|
-
return differenceInSeconds(value, _this.date(comparing));
|
|
403
|
-
default:
|
|
404
|
-
{
|
|
405
|
-
return differenceInMilliseconds(value, _this.date(comparing));
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
this.isEqual = function (value, comparing) {
|
|
410
|
-
if (value === null && comparing === null) {
|
|
411
|
-
return true;
|
|
412
|
-
}
|
|
413
|
-
return isEqual(value, comparing);
|
|
414
|
-
};
|
|
415
|
-
this.isSameYear = function (value, comparing) {
|
|
416
|
-
return isSameYear(value, comparing);
|
|
417
|
-
};
|
|
418
|
-
this.isSameMonth = function (value, comparing) {
|
|
419
|
-
return isSameMonth(value, comparing);
|
|
420
|
-
};
|
|
421
|
-
this.isSameDay = function (value, comparing) {
|
|
422
|
-
return isSameDay(value, comparing);
|
|
423
|
-
};
|
|
424
|
-
this.isSameHour = function (value, comparing) {
|
|
425
|
-
return isSameHour(value, comparing);
|
|
426
|
-
};
|
|
427
|
-
this.isAfter = function (value, comparing) {
|
|
428
|
-
return isAfter(value, comparing);
|
|
429
|
-
};
|
|
430
|
-
this.isAfterYear = function (value, comparing) {
|
|
431
|
-
return isAfter(value, endOfYear(comparing));
|
|
432
|
-
};
|
|
433
|
-
this.isAfterDay = function (value, comparing) {
|
|
434
|
-
return isAfter(value, endOfDay(comparing));
|
|
435
|
-
};
|
|
436
|
-
this.isBefore = function (value, comparing) {
|
|
437
|
-
return isBefore(value, comparing);
|
|
438
|
-
};
|
|
439
|
-
this.isBeforeYear = function (value, comparing) {
|
|
440
|
-
return isBefore(value, startOfYear(comparing));
|
|
441
|
-
};
|
|
442
|
-
this.isBeforeDay = function (value, comparing) {
|
|
443
|
-
return isBefore(value, startOfDay(comparing));
|
|
444
|
-
};
|
|
445
|
-
this.isWithinRange = function (value, _ref2) {
|
|
446
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
447
|
-
start = _ref3[0],
|
|
448
|
-
end = _ref3[1];
|
|
449
|
-
return isWithinInterval(value, {
|
|
450
|
-
start: start,
|
|
451
|
-
end: end
|
|
452
|
-
});
|
|
453
|
-
};
|
|
454
|
-
this.startOfYear = function (value) {
|
|
455
|
-
return startOfYear(value);
|
|
456
|
-
};
|
|
457
|
-
this.startOfMonth = function (value) {
|
|
458
|
-
return startOfMonth(value);
|
|
459
|
-
};
|
|
460
|
-
this.startOfWeek = function (value) {
|
|
461
|
-
return startOfWeek(value, {
|
|
462
|
-
locale: _this.locale
|
|
463
|
-
});
|
|
464
|
-
};
|
|
465
|
-
this.startOfDay = function (value) {
|
|
466
|
-
return startOfDay(value);
|
|
467
|
-
};
|
|
468
|
-
this.endOfYear = function (value) {
|
|
469
|
-
return endOfYear(value);
|
|
470
|
-
};
|
|
471
|
-
this.endOfMonth = function (value) {
|
|
472
|
-
return endOfMonth(value);
|
|
473
|
-
};
|
|
474
|
-
this.endOfWeek = function (value) {
|
|
475
|
-
return endOfWeek(value, {
|
|
476
|
-
locale: _this.locale
|
|
477
|
-
});
|
|
478
|
-
};
|
|
479
|
-
this.endOfDay = function (value) {
|
|
480
|
-
return endOfDay(value);
|
|
481
|
-
};
|
|
482
|
-
this.addYears = function (value, amount) {
|
|
483
|
-
return addYears(value, amount);
|
|
484
|
-
};
|
|
485
|
-
this.addMonths = function (value, amount) {
|
|
486
|
-
return addMonths(value, amount);
|
|
487
|
-
};
|
|
488
|
-
this.addWeeks = function (value, amount) {
|
|
489
|
-
return addWeeks(value, amount);
|
|
490
|
-
};
|
|
491
|
-
this.addDays = function (value, amount) {
|
|
492
|
-
return addDays(value, amount);
|
|
493
|
-
};
|
|
494
|
-
this.addHours = function (value, amount) {
|
|
495
|
-
return addHours(value, amount);
|
|
496
|
-
};
|
|
497
|
-
this.addMinutes = function (value, amount) {
|
|
498
|
-
return addMinutes(value, amount);
|
|
499
|
-
};
|
|
500
|
-
this.addSeconds = function (value, amount) {
|
|
501
|
-
return addSeconds(value, amount);
|
|
502
|
-
};
|
|
503
|
-
this.getYear = function (value) {
|
|
504
|
-
return getYear(value);
|
|
505
|
-
};
|
|
506
|
-
this.getMonth = function (value) {
|
|
507
|
-
return getMonth(value);
|
|
508
|
-
};
|
|
509
|
-
this.getDate = function (value) {
|
|
510
|
-
return getDate(value);
|
|
511
|
-
};
|
|
512
|
-
this.getHours = function (value) {
|
|
513
|
-
return getHours(value);
|
|
514
|
-
};
|
|
515
|
-
this.getMinutes = function (value) {
|
|
516
|
-
return getMinutes(value);
|
|
517
|
-
};
|
|
518
|
-
this.getSeconds = function (value) {
|
|
519
|
-
return getSeconds(value);
|
|
520
|
-
};
|
|
521
|
-
this.getMilliseconds = function (value) {
|
|
522
|
-
return getMilliseconds(value);
|
|
523
|
-
};
|
|
524
|
-
this.setYear = function (value, year) {
|
|
525
|
-
return setYear(value, year);
|
|
526
|
-
};
|
|
527
|
-
this.setMonth = function (value, month) {
|
|
528
|
-
return setMonth(value, month);
|
|
529
|
-
};
|
|
530
|
-
this.setDate = function (value, date) {
|
|
531
|
-
return setDate(value, date);
|
|
532
|
-
};
|
|
533
|
-
this.setHours = function (value, hours) {
|
|
534
|
-
return setHours(value, hours);
|
|
535
|
-
};
|
|
536
|
-
this.setMinutes = function (value, minutes) {
|
|
537
|
-
return setMinutes(value, minutes);
|
|
538
|
-
};
|
|
539
|
-
this.setSeconds = function (value, seconds) {
|
|
540
|
-
return setSeconds(value, seconds);
|
|
541
|
-
};
|
|
542
|
-
this.setMilliseconds = function (value, milliseconds) {
|
|
543
|
-
return setMilliseconds(value, milliseconds);
|
|
544
|
-
};
|
|
545
|
-
this.getDaysInMonth = function (value) {
|
|
546
|
-
return getDaysInMonth(value);
|
|
547
|
-
};
|
|
548
|
-
this.getNextMonth = function (value) {
|
|
549
|
-
return addMonths(value, 1);
|
|
550
|
-
};
|
|
551
|
-
this.getPreviousMonth = function (value) {
|
|
552
|
-
return addMonths(value, -1);
|
|
553
|
-
};
|
|
554
|
-
this.getMonthArray = function (value) {
|
|
555
|
-
var firstMonth = startOfYear(value);
|
|
556
|
-
var monthArray = [firstMonth];
|
|
557
|
-
while (monthArray.length < 12) {
|
|
558
|
-
var prevMonth = monthArray[monthArray.length - 1];
|
|
559
|
-
monthArray.push(_this.getNextMonth(prevMonth));
|
|
560
|
-
}
|
|
561
|
-
return monthArray;
|
|
562
|
-
};
|
|
563
|
-
this.mergeDateAndTime = function (dateParam, timeParam) {
|
|
564
|
-
return _this.setSeconds(_this.setMinutes(_this.setHours(dateParam, _this.getHours(timeParam)), _this.getMinutes(timeParam)), _this.getSeconds(timeParam));
|
|
565
|
-
};
|
|
566
|
-
this.getWeekdays = function () {
|
|
567
|
-
var now = new Date();
|
|
568
|
-
return eachDayOfInterval({
|
|
569
|
-
start: startOfWeek(now, {
|
|
121
|
+
return dateFnsParse(value, format, new Date(), {
|
|
570
122
|
locale: _this.locale
|
|
571
|
-
})
|
|
572
|
-
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
_this.isValid = function (value) {
|
|
126
|
+
return isValid(_this.date(value));
|
|
127
|
+
};
|
|
128
|
+
_this.format = function (value, formatKey) {
|
|
129
|
+
return _this.formatByString(value, _this.formats[formatKey]);
|
|
130
|
+
};
|
|
131
|
+
_this.formatByString = function (value, formatString) {
|
|
132
|
+
return dateFnsFormat(value, formatString, {
|
|
573
133
|
locale: _this.locale
|
|
574
|
-
})
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
_this.getDiff = function (value, comparing, unit) {
|
|
137
|
+
switch (unit) {
|
|
138
|
+
case 'years':
|
|
139
|
+
return differenceInYears(value, _this.date(comparing));
|
|
140
|
+
case 'quarters':
|
|
141
|
+
return differenceInQuarters(value, _this.date(comparing));
|
|
142
|
+
case 'months':
|
|
143
|
+
return differenceInMonths(value, _this.date(comparing));
|
|
144
|
+
case 'weeks':
|
|
145
|
+
return differenceInWeeks(value, _this.date(comparing));
|
|
146
|
+
case 'days':
|
|
147
|
+
return differenceInDays(value, _this.date(comparing));
|
|
148
|
+
case 'hours':
|
|
149
|
+
return differenceInHours(value, _this.date(comparing));
|
|
150
|
+
case 'minutes':
|
|
151
|
+
return differenceInMinutes(value, _this.date(comparing));
|
|
152
|
+
case 'seconds':
|
|
153
|
+
return differenceInSeconds(value, _this.date(comparing));
|
|
154
|
+
default:
|
|
155
|
+
{
|
|
156
|
+
return differenceInMilliseconds(value, _this.date(comparing));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
_this.isEqual = function (value, comparing) {
|
|
161
|
+
if (value === null && comparing === null) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
return isEqual(value, comparing);
|
|
165
|
+
};
|
|
166
|
+
_this.isSameYear = function (value, comparing) {
|
|
167
|
+
return isSameYear(value, comparing);
|
|
168
|
+
};
|
|
169
|
+
_this.isSameMonth = function (value, comparing) {
|
|
170
|
+
return isSameMonth(value, comparing);
|
|
171
|
+
};
|
|
172
|
+
_this.isSameDay = function (value, comparing) {
|
|
173
|
+
return isSameDay(value, comparing);
|
|
174
|
+
};
|
|
175
|
+
_this.isSameHour = function (value, comparing) {
|
|
176
|
+
return isSameHour(value, comparing);
|
|
177
|
+
};
|
|
178
|
+
_this.isAfter = function (value, comparing) {
|
|
179
|
+
return isAfter(value, comparing);
|
|
180
|
+
};
|
|
181
|
+
_this.isAfterYear = function (value, comparing) {
|
|
182
|
+
return isAfter(value, endOfYear(comparing));
|
|
183
|
+
};
|
|
184
|
+
_this.isAfterDay = function (value, comparing) {
|
|
185
|
+
return isAfter(value, endOfDay(comparing));
|
|
186
|
+
};
|
|
187
|
+
_this.isBefore = function (value, comparing) {
|
|
188
|
+
return isBefore(value, comparing);
|
|
189
|
+
};
|
|
190
|
+
_this.isBeforeYear = function (value, comparing) {
|
|
191
|
+
return isBefore(value, startOfYear(comparing));
|
|
192
|
+
};
|
|
193
|
+
_this.isBeforeDay = function (value, comparing) {
|
|
194
|
+
return isBefore(value, startOfDay(comparing));
|
|
195
|
+
};
|
|
196
|
+
_this.isWithinRange = function (value, _ref3) {
|
|
197
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
198
|
+
start = _ref4[0],
|
|
199
|
+
end = _ref4[1];
|
|
200
|
+
return isWithinInterval(value, {
|
|
201
|
+
start: start,
|
|
202
|
+
end: end
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
_this.startOfYear = function (value) {
|
|
206
|
+
return startOfYear(value);
|
|
207
|
+
};
|
|
208
|
+
_this.startOfMonth = function (value) {
|
|
209
|
+
return startOfMonth(value);
|
|
210
|
+
};
|
|
211
|
+
_this.startOfWeek = function (value) {
|
|
212
|
+
return startOfWeek(value, {
|
|
213
|
+
locale: _this.locale
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
_this.startOfDay = function (value) {
|
|
217
|
+
return startOfDay(value);
|
|
218
|
+
};
|
|
219
|
+
_this.endOfYear = function (value) {
|
|
220
|
+
return endOfYear(value);
|
|
221
|
+
};
|
|
222
|
+
_this.endOfMonth = function (value) {
|
|
223
|
+
return endOfMonth(value);
|
|
224
|
+
};
|
|
225
|
+
_this.endOfWeek = function (value) {
|
|
226
|
+
return endOfWeek(value, {
|
|
227
|
+
locale: _this.locale
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
_this.endOfDay = function (value) {
|
|
231
|
+
return endOfDay(value);
|
|
232
|
+
};
|
|
233
|
+
_this.addYears = function (value, amount) {
|
|
234
|
+
return addYears(value, amount);
|
|
235
|
+
};
|
|
236
|
+
_this.addMonths = function (value, amount) {
|
|
237
|
+
return addMonths(value, amount);
|
|
238
|
+
};
|
|
239
|
+
_this.addWeeks = function (value, amount) {
|
|
240
|
+
return addWeeks(value, amount);
|
|
241
|
+
};
|
|
242
|
+
_this.addDays = function (value, amount) {
|
|
243
|
+
return addDays(value, amount);
|
|
244
|
+
};
|
|
245
|
+
_this.addHours = function (value, amount) {
|
|
246
|
+
return addHours(value, amount);
|
|
247
|
+
};
|
|
248
|
+
_this.addMinutes = function (value, amount) {
|
|
249
|
+
return addMinutes(value, amount);
|
|
250
|
+
};
|
|
251
|
+
_this.addSeconds = function (value, amount) {
|
|
252
|
+
return addSeconds(value, amount);
|
|
253
|
+
};
|
|
254
|
+
_this.getYear = function (value) {
|
|
255
|
+
return getYear(value);
|
|
256
|
+
};
|
|
257
|
+
_this.getMonth = function (value) {
|
|
258
|
+
return getMonth(value);
|
|
259
|
+
};
|
|
260
|
+
_this.getDate = function (value) {
|
|
261
|
+
return getDate(value);
|
|
262
|
+
};
|
|
263
|
+
_this.getHours = function (value) {
|
|
264
|
+
return getHours(value);
|
|
265
|
+
};
|
|
266
|
+
_this.getMinutes = function (value) {
|
|
267
|
+
return getMinutes(value);
|
|
268
|
+
};
|
|
269
|
+
_this.getSeconds = function (value) {
|
|
270
|
+
return getSeconds(value);
|
|
271
|
+
};
|
|
272
|
+
_this.getMilliseconds = function (value) {
|
|
273
|
+
return getMilliseconds(value);
|
|
274
|
+
};
|
|
275
|
+
_this.setYear = function (value, year) {
|
|
276
|
+
return setYear(value, year);
|
|
277
|
+
};
|
|
278
|
+
_this.setMonth = function (value, month) {
|
|
279
|
+
return setMonth(value, month);
|
|
280
|
+
};
|
|
281
|
+
_this.setDate = function (value, date) {
|
|
282
|
+
return setDate(value, date);
|
|
283
|
+
};
|
|
284
|
+
_this.setHours = function (value, hours) {
|
|
285
|
+
return setHours(value, hours);
|
|
286
|
+
};
|
|
287
|
+
_this.setMinutes = function (value, minutes) {
|
|
288
|
+
return setMinutes(value, minutes);
|
|
289
|
+
};
|
|
290
|
+
_this.setSeconds = function (value, seconds) {
|
|
291
|
+
return setSeconds(value, seconds);
|
|
292
|
+
};
|
|
293
|
+
_this.setMilliseconds = function (value, milliseconds) {
|
|
294
|
+
return setMilliseconds(value, milliseconds);
|
|
295
|
+
};
|
|
296
|
+
_this.getDaysInMonth = function (value) {
|
|
297
|
+
return getDaysInMonth(value);
|
|
298
|
+
};
|
|
299
|
+
_this.getNextMonth = function (value) {
|
|
300
|
+
return addMonths(value, 1);
|
|
301
|
+
};
|
|
302
|
+
_this.getPreviousMonth = function (value) {
|
|
303
|
+
return addMonths(value, -1);
|
|
304
|
+
};
|
|
305
|
+
_this.getMonthArray = function (value) {
|
|
306
|
+
var firstMonth = startOfYear(value);
|
|
307
|
+
var monthArray = [firstMonth];
|
|
308
|
+
while (monthArray.length < 12) {
|
|
309
|
+
var prevMonth = monthArray[monthArray.length - 1];
|
|
310
|
+
monthArray.push(_this.getNextMonth(prevMonth));
|
|
311
|
+
}
|
|
312
|
+
return monthArray;
|
|
313
|
+
};
|
|
314
|
+
_this.mergeDateAndTime = function (dateParam, timeParam) {
|
|
315
|
+
return _this.setSeconds(_this.setMinutes(_this.setHours(dateParam, _this.getHours(timeParam)), _this.getMinutes(timeParam)), _this.getSeconds(timeParam));
|
|
316
|
+
};
|
|
317
|
+
_this.getWeekdays = function () {
|
|
318
|
+
var now = new Date();
|
|
319
|
+
return eachDayOfInterval({
|
|
320
|
+
start: startOfWeek(now, {
|
|
321
|
+
locale: _this.locale
|
|
322
|
+
}),
|
|
323
|
+
end: endOfWeek(now, {
|
|
324
|
+
locale: _this.locale
|
|
325
|
+
})
|
|
326
|
+
}).map(function (day) {
|
|
327
|
+
return _this.formatByString(day, 'EEEEEE');
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
_this.getWeekArray = function (value) {
|
|
331
|
+
var start = startOfWeek(startOfMonth(value), {
|
|
332
|
+
locale: _this.locale
|
|
333
|
+
});
|
|
334
|
+
var end = endOfWeek(endOfMonth(value), {
|
|
335
|
+
locale: _this.locale
|
|
336
|
+
});
|
|
337
|
+
var count = 0;
|
|
338
|
+
var current = start;
|
|
339
|
+
var nestedWeeks = [];
|
|
340
|
+
while (isBefore(current, end)) {
|
|
341
|
+
var weekNumber = Math.floor(count / 7);
|
|
342
|
+
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
|
343
|
+
nestedWeeks[weekNumber].push(current);
|
|
344
|
+
current = addDays(current, 1);
|
|
345
|
+
count += 1;
|
|
346
|
+
}
|
|
347
|
+
return nestedWeeks;
|
|
348
|
+
};
|
|
349
|
+
_this.getWeekNumber = function (value) {
|
|
350
|
+
return getWeek(value, {
|
|
351
|
+
locale: _this.locale
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
_this.getYearRange = function (start, end) {
|
|
355
|
+
var startDate = startOfYear(start);
|
|
356
|
+
var endDate = endOfYear(end);
|
|
357
|
+
var years = [];
|
|
358
|
+
var current = startDate;
|
|
359
|
+
while (isBefore(current, endDate)) {
|
|
360
|
+
years.push(current);
|
|
361
|
+
current = addYears(current, 1);
|
|
362
|
+
}
|
|
363
|
+
return years;
|
|
364
|
+
};
|
|
365
|
+
return _this;
|
|
366
|
+
}
|
|
367
|
+
return _createClass(AdapterDateFns);
|
|
368
|
+
}(AdapterDateFnsBase);
|