@instructure/ui-date-time-input 8.24.1-snapshot.16 → 8.24.1
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/es/DateTimeInput/index.js +1 -9
- package/lib/DateTimeInput/index.js +1 -9
- package/package.json +19 -20
- package/src/DateTimeInput/index.tsx +1 -13
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateTimeInput/index.d.ts +0 -3
- package/types/DateTimeInput/index.d.ts.map +1 -1
- package/LICENSE.md +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.24.1](https://github.com/instructure/instructure-ui/compare/v8.24.0...v8.24.1) (2022-04-29)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **ui-date-time-input,ui-time-select:** fix selection getting lost after value change ([0604ec5](https://github.com/instructure/instructure-ui/commit/0604ec59c560ca2868fdac84d6f4948f92d38d5b))
|
|
11
|
+
|
|
6
12
|
# [8.24.0](https://github.com/instructure/instructure-ui/compare/v8.23.0...v8.24.0) (2022-04-26)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -50,7 +50,6 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
|
|
|
50
50
|
// componentDidMount()
|
|
51
51
|
|
|
52
52
|
this.context = void 0;
|
|
53
|
-
this._timeInput = void 0;
|
|
54
53
|
this.ref = null;
|
|
55
54
|
|
|
56
55
|
this.handleRef = el => {
|
|
@@ -142,10 +141,6 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
|
|
|
142
141
|
}
|
|
143
142
|
};
|
|
144
143
|
|
|
145
|
-
this.timeInputComponentRef = node => {
|
|
146
|
-
this._timeInput = node;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
144
|
this.handleShowCalendar = _event => {
|
|
150
145
|
this.setState({
|
|
151
146
|
isShowingCalendar: true
|
|
@@ -241,8 +236,6 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
|
|
|
241
236
|
const parsed = DateTime.parse(dateStr, this.locale(), this.timezone());
|
|
242
237
|
|
|
243
238
|
if (parsed.isValid()) {
|
|
244
|
-
var _this$state, _this$_timeInput;
|
|
245
|
-
|
|
246
239
|
if (doNotChangeTime && this.state.timeSelectValue) {
|
|
247
240
|
// There is a selected time, adjust the parsed date to its value
|
|
248
241
|
const timeParsed = DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
@@ -253,7 +246,7 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
|
|
|
253
246
|
parsed.date(this.state.iso.date()).month(this.state.iso.month()).year(this.state.iso.year());
|
|
254
247
|
}
|
|
255
248
|
|
|
256
|
-
const newTimeSelectValue =
|
|
249
|
+
const newTimeSelectValue = parsed.toISOString();
|
|
257
250
|
|
|
258
251
|
if (this.isDisabledDate(parsed)) {
|
|
259
252
|
let text = typeof this.props.disabledDateTimeMessage === 'function' ? this.props.disabledDateTimeMessage(parsed.toISOString(true)) : this.props.disabledDateTimeMessage;
|
|
@@ -523,7 +516,6 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
|
|
|
523
516
|
value: this.state.timeSelectValue,
|
|
524
517
|
onChange: this.handleTimeChange,
|
|
525
518
|
onBlur: this.handleBlur,
|
|
526
|
-
ref: this.timeInputComponentRef,
|
|
527
519
|
renderLabel: timeRenderLabel,
|
|
528
520
|
locale: locale,
|
|
529
521
|
format: timeFormat,
|
|
@@ -53,7 +53,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
53
53
|
// componentDidMount()
|
|
54
54
|
|
|
55
55
|
this.context = void 0;
|
|
56
|
-
this._timeInput = void 0;
|
|
57
56
|
this.ref = null;
|
|
58
57
|
|
|
59
58
|
this.handleRef = el => {
|
|
@@ -147,10 +146,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
147
146
|
}
|
|
148
147
|
};
|
|
149
148
|
|
|
150
|
-
this.timeInputComponentRef = node => {
|
|
151
|
-
this._timeInput = node;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
149
|
this.handleShowCalendar = _event => {
|
|
155
150
|
this.setState({
|
|
156
151
|
isShowingCalendar: true
|
|
@@ -246,8 +241,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
246
241
|
const parsed = _DateTime.DateTime.parse(dateStr, this.locale(), this.timezone());
|
|
247
242
|
|
|
248
243
|
if (parsed.isValid()) {
|
|
249
|
-
var _this$state, _this$_timeInput;
|
|
250
|
-
|
|
251
244
|
if (doNotChangeTime && this.state.timeSelectValue) {
|
|
252
245
|
// There is a selected time, adjust the parsed date to its value
|
|
253
246
|
const timeParsed = _DateTime.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
@@ -259,7 +252,7 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
259
252
|
parsed.date(this.state.iso.date()).month(this.state.iso.month()).year(this.state.iso.year());
|
|
260
253
|
}
|
|
261
254
|
|
|
262
|
-
const newTimeSelectValue =
|
|
255
|
+
const newTimeSelectValue = parsed.toISOString();
|
|
263
256
|
|
|
264
257
|
if (this.isDisabledDate(parsed)) {
|
|
265
258
|
let text = typeof this.props.disabledDateTimeMessage === 'function' ? this.props.disabledDateTimeMessage(parsed.toISOString(true)) : this.props.disabledDateTimeMessage;
|
|
@@ -534,7 +527,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
534
527
|
value: this.state.timeSelectValue,
|
|
535
528
|
onChange: this.handleTimeChange,
|
|
536
529
|
onBlur: this.handleBlur,
|
|
537
|
-
ref: this.timeInputComponentRef,
|
|
538
530
|
renderLabel: timeRenderLabel,
|
|
539
531
|
locale: locale,
|
|
540
532
|
format: timeFormat,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-date-time-input",
|
|
3
|
-
"version": "8.24.1
|
|
3
|
+
"version": "8.24.1",
|
|
4
4
|
"description": "A UI component that allows to select date and time.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,26 +23,26 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.24.1
|
|
27
|
-
"@instructure/ui-test-locator": "8.24.1
|
|
28
|
-
"@instructure/ui-test-utils": "8.24.1
|
|
26
|
+
"@instructure/ui-babel-preset": "8.24.1",
|
|
27
|
+
"@instructure/ui-test-locator": "8.24.1",
|
|
28
|
+
"@instructure/ui-test-utils": "8.24.1"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "^7.13.10",
|
|
32
|
-
"@instructure/debounce": "8.24.1
|
|
33
|
-
"@instructure/emotion": "8.24.1
|
|
34
|
-
"@instructure/ui-a11y-content": "8.24.1
|
|
35
|
-
"@instructure/ui-buttons": "8.24.1
|
|
36
|
-
"@instructure/ui-calendar": "8.24.1
|
|
37
|
-
"@instructure/ui-date-input": "8.24.1
|
|
38
|
-
"@instructure/ui-form-field": "8.24.1
|
|
39
|
-
"@instructure/ui-i18n": "8.24.1
|
|
40
|
-
"@instructure/ui-icons": "8.24.1
|
|
41
|
-
"@instructure/ui-prop-types": "8.24.1
|
|
42
|
-
"@instructure/ui-react-utils": "8.24.1
|
|
43
|
-
"@instructure/ui-testable": "8.24.1
|
|
44
|
-
"@instructure/ui-time-select": "8.24.1
|
|
45
|
-
"@instructure/ui-utils": "8.24.1
|
|
32
|
+
"@instructure/debounce": "8.24.1",
|
|
33
|
+
"@instructure/emotion": "8.24.1",
|
|
34
|
+
"@instructure/ui-a11y-content": "8.24.1",
|
|
35
|
+
"@instructure/ui-buttons": "8.24.1",
|
|
36
|
+
"@instructure/ui-calendar": "8.24.1",
|
|
37
|
+
"@instructure/ui-date-input": "8.24.1",
|
|
38
|
+
"@instructure/ui-form-field": "8.24.1",
|
|
39
|
+
"@instructure/ui-i18n": "8.24.1",
|
|
40
|
+
"@instructure/ui-icons": "8.24.1",
|
|
41
|
+
"@instructure/ui-prop-types": "8.24.1",
|
|
42
|
+
"@instructure/ui-react-utils": "8.24.1",
|
|
43
|
+
"@instructure/ui-testable": "8.24.1",
|
|
44
|
+
"@instructure/ui-time-select": "8.24.1",
|
|
45
|
+
"@instructure/ui-utils": "8.24.1",
|
|
46
46
|
"prop-types": "^15"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -51,6 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"sideEffects": false
|
|
55
|
-
"gitHead": "363893b5f0575cc9743cdaa7fae4c404f3fb9cca"
|
|
54
|
+
"sideEffects": false
|
|
56
55
|
}
|
|
@@ -68,7 +68,6 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
68
68
|
|
|
69
69
|
static contextType = ApplyLocaleContext
|
|
70
70
|
|
|
71
|
-
private _timeInput?: TimeSelect
|
|
72
71
|
ref: Element | null = null // This is used by Tooltip for positioning
|
|
73
72
|
|
|
74
73
|
handleRef = (el: Element | null) => {
|
|
@@ -136,13 +135,7 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
136
135
|
.month(this.state.iso.month())
|
|
137
136
|
.year(this.state.iso.year())
|
|
138
137
|
}
|
|
139
|
-
const newTimeSelectValue =
|
|
140
|
-
? this.state.timeSelectValue
|
|
141
|
-
: this._timeInput
|
|
142
|
-
?.getBaseDate()
|
|
143
|
-
.minute(parsed.minute())
|
|
144
|
-
.hour(parsed.hour())
|
|
145
|
-
.toISOString()
|
|
138
|
+
const newTimeSelectValue = parsed.toISOString()
|
|
146
139
|
if (this.isDisabledDate(parsed)) {
|
|
147
140
|
let text =
|
|
148
141
|
typeof this.props.disabledDateTimeMessage === 'function'
|
|
@@ -359,10 +352,6 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
359
352
|
}
|
|
360
353
|
}
|
|
361
354
|
|
|
362
|
-
timeInputComponentRef = (node: TimeSelect) => {
|
|
363
|
-
this._timeInput = node
|
|
364
|
-
}
|
|
365
|
-
|
|
366
355
|
handleShowCalendar = (_event: SyntheticEvent) => {
|
|
367
356
|
this.setState({ isShowingCalendar: true })
|
|
368
357
|
}
|
|
@@ -589,7 +578,6 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
589
578
|
value={this.state.timeSelectValue}
|
|
590
579
|
onChange={this.handleTimeChange}
|
|
591
580
|
onBlur={this.handleBlur}
|
|
592
|
-
ref={this.timeInputComponentRef}
|
|
593
581
|
renderLabel={timeRenderLabel}
|
|
594
582
|
locale={locale}
|
|
595
583
|
format={timeFormat}
|