@atlaskit/datetime-picker 12.3.6 → 12.3.7
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/CHANGELOG.md +6 -0
- package/dist/cjs/components/date-picker.js +27 -9
- package/dist/cjs/components/date-time-picker.js +1 -1
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/date-picker.js +27 -9
- package/dist/es2019/components/date-time-picker.js +1 -1
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/date-picker.js +28 -9
- package/dist/esm/components/date-time-picker.js +1 -1
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/date-picker.d.ts +1 -0
- package/package.json +1 -1
- package/report.api.md +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 12.3.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`98891267a5e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/98891267a5e) - [ux] Dates entered with 5+ digit years will no longer throw a RangeError
|
|
8
|
+
|
|
3
9
|
## 12.3.6
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -68,7 +68,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
68
68
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
69
69
|
|
|
70
70
|
var packageName = "@atlaskit/datetime-picker";
|
|
71
|
-
var packageVersion = "12.3.
|
|
71
|
+
var packageVersion = "12.3.7";
|
|
72
72
|
/* eslint-disable react/no-unused-prop-types */
|
|
73
73
|
|
|
74
74
|
function getDateObj(date) {
|
|
@@ -264,6 +264,20 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
264
264
|
isOpen: true
|
|
265
265
|
});
|
|
266
266
|
});
|
|
267
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSafeView", function (view) {
|
|
268
|
+
// If view has a year that is greater than 9999, default to today's date
|
|
269
|
+
var yearIsOverLimit = view.match(/^\d{5,}/);
|
|
270
|
+
|
|
271
|
+
if (yearIsOverLimit) {
|
|
272
|
+
var today = new Date();
|
|
273
|
+
var year = today.getFullYear();
|
|
274
|
+
var month = (today.getMonth() + 1).toString().padStart(2, '0');
|
|
275
|
+
var day = today.getDate().toString().padStart(2, '0');
|
|
276
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return view;
|
|
280
|
+
});
|
|
267
281
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSelectKeyDown", function (event) {
|
|
268
282
|
var _this$getSafeState2 = _this.getSafeState(),
|
|
269
283
|
view = _this$getSafeState2.view,
|
|
@@ -330,20 +344,24 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
330
344
|
|
|
331
345
|
if (!_this.isDateDisabled(view)) {
|
|
332
346
|
var _this$getSafeState3 = _this.getSafeState(),
|
|
333
|
-
_value = _this$getSafeState3.value;
|
|
347
|
+
_value = _this$getSafeState3.value; // Get a safe `view` value in case the value exceeds the maximum
|
|
348
|
+
// allowed by ISO 8601
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
var safeView = _this.getSafeView(view);
|
|
334
352
|
|
|
335
|
-
var valueChanged =
|
|
353
|
+
var valueChanged = safeView !== _value;
|
|
336
354
|
|
|
337
355
|
_this.setState({
|
|
338
356
|
inputValue: '',
|
|
339
357
|
isOpen: false,
|
|
340
|
-
selectedValue:
|
|
341
|
-
value:
|
|
342
|
-
view:
|
|
358
|
+
selectedValue: safeView,
|
|
359
|
+
value: safeView,
|
|
360
|
+
view: safeView
|
|
343
361
|
});
|
|
344
362
|
|
|
345
363
|
if (valueChanged) {
|
|
346
|
-
_this.props.onChange(
|
|
364
|
+
_this.props.onChange(safeView);
|
|
347
365
|
}
|
|
348
366
|
}
|
|
349
367
|
|
|
@@ -443,7 +461,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
443
461
|
});
|
|
444
462
|
|
|
445
463
|
var _getDateObj = getDateObj(new Date()),
|
|
446
|
-
|
|
464
|
+
_day = _getDateObj.day,
|
|
447
465
|
_month = _getDateObj.month,
|
|
448
466
|
_year = _getDateObj.year;
|
|
449
467
|
|
|
@@ -454,7 +472,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
454
472
|
inputValue: _this.props.selectProps.inputValue,
|
|
455
473
|
selectedValue: _this.props.value || _this.props.defaultValue,
|
|
456
474
|
value: _this.props.defaultValue,
|
|
457
|
-
view: _this.props.value || _this.props.defaultValue || "".concat(_year, "-").concat((0, _internal.padToTwo)(_month), "-").concat((0, _internal.padToTwo)(
|
|
475
|
+
view: _this.props.value || _this.props.defaultValue || "".concat(_year, "-").concat((0, _internal.padToTwo)(_month), "-").concat((0, _internal.padToTwo)(_day)),
|
|
458
476
|
l10n: (0, _locale.createLocalizationProvider)(_this.props.locale)
|
|
459
477
|
};
|
|
460
478
|
return _this;
|
|
@@ -58,7 +58,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
58
58
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
59
59
|
|
|
60
60
|
var packageName = "@atlaskit/datetime-picker";
|
|
61
|
-
var packageVersion = "12.3.
|
|
61
|
+
var packageVersion = "12.3.7";
|
|
62
62
|
/* eslint-disable react/no-unused-prop-types */
|
|
63
63
|
|
|
64
64
|
var isInvalidBorderStyles = (0, _react2.css)({
|
|
@@ -65,7 +65,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
65
65
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
66
66
|
|
|
67
67
|
var packageName = "@atlaskit/datetime-picker";
|
|
68
|
-
var packageVersion = "12.3.
|
|
68
|
+
var packageVersion = "12.3.7";
|
|
69
69
|
var menuStyles = {
|
|
70
70
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
71
71
|
position: 'static',
|
package/dist/cjs/version.json
CHANGED
|
@@ -20,7 +20,7 @@ import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from
|
|
|
20
20
|
import FixedLayer from '../internal/fixed-layer';
|
|
21
21
|
import { convertTokens } from './utils';
|
|
22
22
|
const packageName = "@atlaskit/datetime-picker";
|
|
23
|
-
const packageVersion = "12.3.
|
|
23
|
+
const packageVersion = "12.3.7";
|
|
24
24
|
/* eslint-disable react/no-unused-prop-types */
|
|
25
25
|
|
|
26
26
|
function getDateObj(date) {
|
|
@@ -214,6 +214,21 @@ class DatePicker extends Component {
|
|
|
214
214
|
});
|
|
215
215
|
});
|
|
216
216
|
|
|
217
|
+
_defineProperty(this, "getSafeView", view => {
|
|
218
|
+
// If view has a year that is greater than 9999, default to today's date
|
|
219
|
+
const yearIsOverLimit = view.match(/^\d{5,}/);
|
|
220
|
+
|
|
221
|
+
if (yearIsOverLimit) {
|
|
222
|
+
const today = new Date();
|
|
223
|
+
const year = today.getFullYear();
|
|
224
|
+
const month = (today.getMonth() + 1).toString().padStart(2, '0');
|
|
225
|
+
const day = today.getDate().toString().padStart(2, '0');
|
|
226
|
+
return `${year}-${month}-${day}`;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return view;
|
|
230
|
+
});
|
|
231
|
+
|
|
217
232
|
_defineProperty(this, "onSelectKeyDown", event => {
|
|
218
233
|
const {
|
|
219
234
|
view,
|
|
@@ -276,18 +291,21 @@ class DatePicker extends Component {
|
|
|
276
291
|
if (!this.isDateDisabled(view)) {
|
|
277
292
|
const {
|
|
278
293
|
value
|
|
279
|
-
} = this.getSafeState();
|
|
280
|
-
|
|
294
|
+
} = this.getSafeState(); // Get a safe `view` value in case the value exceeds the maximum
|
|
295
|
+
// allowed by ISO 8601
|
|
296
|
+
|
|
297
|
+
const safeView = this.getSafeView(view);
|
|
298
|
+
const valueChanged = safeView !== value;
|
|
281
299
|
this.setState({
|
|
282
300
|
inputValue: '',
|
|
283
301
|
isOpen: false,
|
|
284
|
-
selectedValue:
|
|
285
|
-
value:
|
|
286
|
-
view
|
|
302
|
+
selectedValue: safeView,
|
|
303
|
+
value: safeView,
|
|
304
|
+
view: safeView
|
|
287
305
|
});
|
|
288
306
|
|
|
289
307
|
if (valueChanged) {
|
|
290
|
-
this.props.onChange(
|
|
308
|
+
this.props.onChange(safeView);
|
|
291
309
|
}
|
|
292
310
|
}
|
|
293
311
|
|
|
@@ -400,7 +418,7 @@ class DatePicker extends Component {
|
|
|
400
418
|
});
|
|
401
419
|
|
|
402
420
|
const {
|
|
403
|
-
day,
|
|
421
|
+
day: _day,
|
|
404
422
|
month: _month,
|
|
405
423
|
year: _year
|
|
406
424
|
} = getDateObj(new Date());
|
|
@@ -411,7 +429,7 @@ class DatePicker extends Component {
|
|
|
411
429
|
inputValue: this.props.selectProps.inputValue,
|
|
412
430
|
selectedValue: this.props.value || this.props.defaultValue,
|
|
413
431
|
value: this.props.defaultValue,
|
|
414
|
-
view: this.props.value || this.props.defaultValue || `${_year}-${padToTwo(_month)}-${padToTwo(
|
|
432
|
+
view: this.props.value || this.props.defaultValue || `${_year}-${padToTwo(_month)}-${padToTwo(_day)}`,
|
|
415
433
|
l10n: createLocalizationProvider(this.props.locale)
|
|
416
434
|
};
|
|
417
435
|
}
|
|
@@ -19,7 +19,7 @@ import DatePicker from './date-picker';
|
|
|
19
19
|
import TimePicker from './time-picker';
|
|
20
20
|
import { convertTokens } from './utils';
|
|
21
21
|
const packageName = "@atlaskit/datetime-picker";
|
|
22
|
-
const packageVersion = "12.3.
|
|
22
|
+
const packageVersion = "12.3.7";
|
|
23
23
|
/* eslint-disable react/no-unused-prop-types */
|
|
24
24
|
|
|
25
25
|
const isInvalidBorderStyles = css({
|
|
@@ -15,7 +15,7 @@ import FixedLayer from '../internal/fixed-layer';
|
|
|
15
15
|
import parseTime from '../internal/parse-time';
|
|
16
16
|
import { convertTokens } from './utils';
|
|
17
17
|
const packageName = "@atlaskit/datetime-picker";
|
|
18
|
-
const packageVersion = "12.3.
|
|
18
|
+
const packageVersion = "12.3.7";
|
|
19
19
|
const menuStyles = {
|
|
20
20
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
21
21
|
position: 'static',
|
package/dist/es2019/version.json
CHANGED
|
@@ -35,7 +35,7 @@ import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from
|
|
|
35
35
|
import FixedLayer from '../internal/fixed-layer';
|
|
36
36
|
import { convertTokens } from './utils';
|
|
37
37
|
var packageName = "@atlaskit/datetime-picker";
|
|
38
|
-
var packageVersion = "12.3.
|
|
38
|
+
var packageVersion = "12.3.7";
|
|
39
39
|
/* eslint-disable react/no-unused-prop-types */
|
|
40
40
|
|
|
41
41
|
function getDateObj(date) {
|
|
@@ -243,6 +243,21 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
243
243
|
});
|
|
244
244
|
});
|
|
245
245
|
|
|
246
|
+
_defineProperty(_assertThisInitialized(_this), "getSafeView", function (view) {
|
|
247
|
+
// If view has a year that is greater than 9999, default to today's date
|
|
248
|
+
var yearIsOverLimit = view.match(/^\d{5,}/);
|
|
249
|
+
|
|
250
|
+
if (yearIsOverLimit) {
|
|
251
|
+
var today = new Date();
|
|
252
|
+
var year = today.getFullYear();
|
|
253
|
+
var month = (today.getMonth() + 1).toString().padStart(2, '0');
|
|
254
|
+
var day = today.getDate().toString().padStart(2, '0');
|
|
255
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return view;
|
|
259
|
+
});
|
|
260
|
+
|
|
246
261
|
_defineProperty(_assertThisInitialized(_this), "onSelectKeyDown", function (event) {
|
|
247
262
|
var _this$getSafeState2 = _this.getSafeState(),
|
|
248
263
|
view = _this$getSafeState2.view,
|
|
@@ -309,20 +324,24 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
309
324
|
|
|
310
325
|
if (!_this.isDateDisabled(view)) {
|
|
311
326
|
var _this$getSafeState3 = _this.getSafeState(),
|
|
312
|
-
_value = _this$getSafeState3.value;
|
|
327
|
+
_value = _this$getSafeState3.value; // Get a safe `view` value in case the value exceeds the maximum
|
|
328
|
+
// allowed by ISO 8601
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
var safeView = _this.getSafeView(view);
|
|
313
332
|
|
|
314
|
-
var valueChanged =
|
|
333
|
+
var valueChanged = safeView !== _value;
|
|
315
334
|
|
|
316
335
|
_this.setState({
|
|
317
336
|
inputValue: '',
|
|
318
337
|
isOpen: false,
|
|
319
|
-
selectedValue:
|
|
320
|
-
value:
|
|
321
|
-
view:
|
|
338
|
+
selectedValue: safeView,
|
|
339
|
+
value: safeView,
|
|
340
|
+
view: safeView
|
|
322
341
|
});
|
|
323
342
|
|
|
324
343
|
if (valueChanged) {
|
|
325
|
-
_this.props.onChange(
|
|
344
|
+
_this.props.onChange(safeView);
|
|
326
345
|
}
|
|
327
346
|
}
|
|
328
347
|
|
|
@@ -430,7 +449,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
430
449
|
});
|
|
431
450
|
|
|
432
451
|
var _getDateObj = getDateObj(new Date()),
|
|
433
|
-
|
|
452
|
+
_day = _getDateObj.day,
|
|
434
453
|
_month = _getDateObj.month,
|
|
435
454
|
_year = _getDateObj.year;
|
|
436
455
|
|
|
@@ -441,7 +460,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
441
460
|
inputValue: _this.props.selectProps.inputValue,
|
|
442
461
|
selectedValue: _this.props.value || _this.props.defaultValue,
|
|
443
462
|
value: _this.props.defaultValue,
|
|
444
|
-
view: _this.props.value || _this.props.defaultValue || "".concat(_year, "-").concat(padToTwo(_month), "-").concat(padToTwo(
|
|
463
|
+
view: _this.props.value || _this.props.defaultValue || "".concat(_year, "-").concat(padToTwo(_month), "-").concat(padToTwo(_day)),
|
|
445
464
|
l10n: createLocalizationProvider(_this.props.locale)
|
|
446
465
|
};
|
|
447
466
|
return _this;
|
|
@@ -33,7 +33,7 @@ import DatePicker from './date-picker';
|
|
|
33
33
|
import TimePicker from './time-picker';
|
|
34
34
|
import { convertTokens } from './utils';
|
|
35
35
|
var packageName = "@atlaskit/datetime-picker";
|
|
36
|
-
var packageVersion = "12.3.
|
|
36
|
+
var packageVersion = "12.3.7";
|
|
37
37
|
/* eslint-disable react/no-unused-prop-types */
|
|
38
38
|
|
|
39
39
|
var isInvalidBorderStyles = css({
|
|
@@ -32,7 +32,7 @@ import FixedLayer from '../internal/fixed-layer';
|
|
|
32
32
|
import parseTime from '../internal/parse-time';
|
|
33
33
|
import { convertTokens } from './utils';
|
|
34
34
|
var packageName = "@atlaskit/datetime-picker";
|
|
35
|
-
var packageVersion = "12.3.
|
|
35
|
+
var packageVersion = "12.3.7";
|
|
36
36
|
var menuStyles = {
|
|
37
37
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
38
38
|
position: 'static',
|
package/dist/esm/version.json
CHANGED
|
@@ -239,6 +239,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
|
|
|
239
239
|
onSelectBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
240
240
|
onSelectFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
241
241
|
onSelectInput: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
242
|
+
getSafeView: (view: string) => string;
|
|
242
243
|
onSelectKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
243
244
|
onClear: () => void;
|
|
244
245
|
onSelectChange: (value: ValueType<OptionType>, action: ActionMeta) => void;
|
package/package.json
CHANGED
package/report.api.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
### Table of contents
|
|
9
9
|
|
|
10
10
|
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
11
12
|
|
|
12
13
|
### Main Entry Types
|
|
13
14
|
|
|
@@ -518,3 +519,15 @@ type TimePickerProps_2 = typeof timePickerDefaultProps & TimePickerProps;
|
|
|
518
519
|
```
|
|
519
520
|
|
|
520
521
|
<!--SECTION END: Main Entry Types-->
|
|
522
|
+
|
|
523
|
+
### Peer Dependencies
|
|
524
|
+
|
|
525
|
+
<!--SECTION START: Peer Dependencies-->
|
|
526
|
+
|
|
527
|
+
```json
|
|
528
|
+
{
|
|
529
|
+
"react": "^16.8.0"
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
<!--SECTION END: Peer Dependencies-->
|