@instructure/ui-date-time-input 11.7.8 → 11.7.9-snapshot-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 +8 -0
- package/lib/DateTimeInput/v1/index.js +28 -31
- package/lib/DateTimeInput/v2/index.js +8 -10
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [11.7.9-snapshot-1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-1) (2026-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-date-time-input
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-date-time-input
|
|
@@ -5,17 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.DateTimeInput = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
9
|
-
var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
|
|
10
|
-
var _ApplyLocaleContext = require("@instructure/ui-i18n/lib/ApplyLocale/ApplyLocaleContext.js");
|
|
8
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
11
9
|
var _v11_ = require("@instructure/ui-form-field/v11_6");
|
|
12
10
|
var _v11_2 = require("@instructure/ui-date-input/v11_6");
|
|
13
11
|
var _v11_3 = require("@instructure/ui-time-select/v11_6");
|
|
14
12
|
var _v11_4 = require("@instructure/ui-calendar/v11_6");
|
|
15
|
-
var
|
|
13
|
+
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
|
16
14
|
var _v11_5 = require("@instructure/ui-buttons/v11_6");
|
|
17
|
-
var
|
|
18
|
-
var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenStartSolid.js");
|
|
15
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
19
16
|
var _props = require("./props.js");
|
|
20
17
|
var _console = require("@instructure/console");
|
|
21
18
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
@@ -64,7 +61,7 @@ category: components
|
|
|
64
61
|
// Localized date with full month, e.g. "August 6, 2014"
|
|
65
62
|
allowNonStepInput: false
|
|
66
63
|
};
|
|
67
|
-
static contextType =
|
|
64
|
+
static contextType = _uiI18n.ApplyLocaleContext;
|
|
68
65
|
ref = null; // This is used by Tooltip for positioning
|
|
69
66
|
|
|
70
67
|
handleRef = el => {
|
|
@@ -97,11 +94,11 @@ category: components
|
|
|
97
94
|
recalculateState(dateStr, doNotChangeDate = false, doNotChangeTime = false) {
|
|
98
95
|
let errorMsg;
|
|
99
96
|
if (dateStr) {
|
|
100
|
-
const parsed =
|
|
97
|
+
const parsed = _uiI18n.DateTime.parse(dateStr, this.locale(), this.timezone());
|
|
101
98
|
if (parsed.isValid()) {
|
|
102
99
|
if (doNotChangeTime && this.state.timeSelectValue) {
|
|
103
100
|
// There is a selected time, adjust the parsed date to its value
|
|
104
|
-
const timeParsed =
|
|
101
|
+
const timeParsed = _uiI18n.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
105
102
|
parsed.hour(timeParsed.hour()).minute(timeParsed.minute());
|
|
106
103
|
}
|
|
107
104
|
if (doNotChangeDate && this.state.iso) {
|
|
@@ -161,7 +158,7 @@ category: components
|
|
|
161
158
|
iso: undefined,
|
|
162
159
|
calendarSelectedDate: undefined,
|
|
163
160
|
dateInputText: dateStr ? dateStr : '',
|
|
164
|
-
renderedDate:
|
|
161
|
+
renderedDate: _uiI18n.DateTime.now(this.locale(), this.timezone()),
|
|
165
162
|
dateInputTextChanged: false,
|
|
166
163
|
...clearTimeSelect
|
|
167
164
|
};
|
|
@@ -173,7 +170,7 @@ category: components
|
|
|
173
170
|
} else if (this.context && this.context.locale) {
|
|
174
171
|
return this.context.locale;
|
|
175
172
|
}
|
|
176
|
-
return
|
|
173
|
+
return _uiI18n.Locale.browserLocale();
|
|
177
174
|
}
|
|
178
175
|
timezone() {
|
|
179
176
|
if (this.props.timezone) {
|
|
@@ -181,7 +178,7 @@ category: components
|
|
|
181
178
|
} else if (this.context && this.context.timezone) {
|
|
182
179
|
return this.context.timezone;
|
|
183
180
|
}
|
|
184
|
-
return
|
|
181
|
+
return _uiI18n.DateTime.browserTimeZone();
|
|
185
182
|
}
|
|
186
183
|
get dateFormat() {
|
|
187
184
|
return this.props.dateFormat;
|
|
@@ -209,11 +206,11 @@ category: components
|
|
|
209
206
|
dateInputText: date.value,
|
|
210
207
|
dateInputTextChanged: true,
|
|
211
208
|
calendarSelectedDate: dateParsed ? dateParsed : undefined,
|
|
212
|
-
renderedDate: dateParsed ? dateParsed.clone() :
|
|
209
|
+
renderedDate: dateParsed ? dateParsed.clone() : _uiI18n.DateTime.now(this.locale(), this.timezone())
|
|
213
210
|
});
|
|
214
211
|
};
|
|
215
212
|
tryParseDate(val) {
|
|
216
|
-
const parsed =
|
|
213
|
+
const parsed = _uiI18n.DateTime.parse(val, this.locale(), this.timezone());
|
|
217
214
|
return parsed.isValid() ? parsed : null;
|
|
218
215
|
}
|
|
219
216
|
|
|
@@ -221,7 +218,7 @@ category: components
|
|
|
221
218
|
handleDayClick = (event, {
|
|
222
219
|
date
|
|
223
220
|
}) => {
|
|
224
|
-
const dateParsed =
|
|
221
|
+
const dateParsed = _uiI18n.DateTime.parse(date, this.locale(), this.timezone());
|
|
225
222
|
this.updateStateBasedOnDateInput(dateParsed, event);
|
|
226
223
|
};
|
|
227
224
|
handleHideCalendar = event => {
|
|
@@ -249,7 +246,7 @@ category: components
|
|
|
249
246
|
let newState;
|
|
250
247
|
if (dateParsed && this.state.timeSelectValue && (!this.state.dateInputText || this.state.dateInputText == '')) {
|
|
251
248
|
// There is already a selected time, but no date. Adjust the time too
|
|
252
|
-
const timeParsed =
|
|
249
|
+
const timeParsed = _uiI18n.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
253
250
|
const dateParsedAdjusted = dateParsed.set({
|
|
254
251
|
hour: timeParsed.hour(),
|
|
255
252
|
minute: timeParsed.minute()
|
|
@@ -324,7 +321,7 @@ category: components
|
|
|
324
321
|
} else if (this.state.iso) {
|
|
325
322
|
toAlter = this.state.iso.clone();
|
|
326
323
|
} else {
|
|
327
|
-
toAlter =
|
|
324
|
+
toAlter = _uiI18n.DateTime.now(this.locale(), this.timezone());
|
|
328
325
|
}
|
|
329
326
|
toAlter.add({
|
|
330
327
|
days: 1
|
|
@@ -341,7 +338,7 @@ category: components
|
|
|
341
338
|
} else if (this.state.iso) {
|
|
342
339
|
toAlter = this.state.iso.clone();
|
|
343
340
|
} else {
|
|
344
|
-
toAlter =
|
|
341
|
+
toAlter = _uiI18n.DateTime.now(this.locale(), this.timezone());
|
|
345
342
|
}
|
|
346
343
|
toAlter.subtract({
|
|
347
344
|
days: 1
|
|
@@ -373,7 +370,7 @@ category: components
|
|
|
373
370
|
// Sets it to the first local day of the week counting back from the start of the month.
|
|
374
371
|
// Note that first day depends on the locale, e.g. it's Sunday in the US and
|
|
375
372
|
// Monday in most of the EU.
|
|
376
|
-
const currDate =
|
|
373
|
+
const currDate = _uiI18n.DateTime.getFirstDayOfWeek(renderedDate.startOf('month'));
|
|
377
374
|
const arr = [];
|
|
378
375
|
for (let i = 0; i < _v11_4.Calendar.DAY_COUNT; i++) {
|
|
379
376
|
// This workaround is needed because moment's `.add({days: 1})` function has a bug that happens when the date added lands perfectly onto the DST cutoff,
|
|
@@ -400,7 +397,7 @@ category: components
|
|
|
400
397
|
return (0, _jsxRuntime.jsx)(_v11_2.DateInput.Day, {
|
|
401
398
|
date: dateStr,
|
|
402
399
|
isSelected: this.state.calendarSelectedDate ? date.isSame(this.state.calendarSelectedDate, 'day') : false,
|
|
403
|
-
isToday: date.isSame(
|
|
400
|
+
isToday: date.isSame(_uiI18n.DateTime.now(this.locale(), this.timezone()), 'day'),
|
|
404
401
|
isOutsideMonth: !date.isSame(renderedDate, 'month'),
|
|
405
402
|
label: date.format('D MMMM YYYY') // used by screen readers
|
|
406
403
|
,
|
|
@@ -418,27 +415,27 @@ category: components
|
|
|
418
415
|
// this is an expensive function, only execute if the calendar is open
|
|
419
416
|
return [];
|
|
420
417
|
}
|
|
421
|
-
const shortDayNames =
|
|
422
|
-
const longDayNames =
|
|
423
|
-
return [(0, _jsxRuntime.jsx)(
|
|
418
|
+
const shortDayNames = _uiI18n.DateTime.getLocalDayNamesOfTheWeek(this.locale(), 'short');
|
|
419
|
+
const longDayNames = _uiI18n.DateTime.getLocalDayNamesOfTheWeek(this.locale(), 'long');
|
|
420
|
+
return [(0, _jsxRuntime.jsx)(_uiA11yContent.AccessibleContent, {
|
|
424
421
|
alt: longDayNames[0],
|
|
425
422
|
children: shortDayNames[0]
|
|
426
|
-
}, 1), (0, _jsxRuntime.jsx)(
|
|
423
|
+
}, 1), (0, _jsxRuntime.jsx)(_uiA11yContent.AccessibleContent, {
|
|
427
424
|
alt: longDayNames[1],
|
|
428
425
|
children: shortDayNames[1]
|
|
429
|
-
}, 2), (0, _jsxRuntime.jsx)(
|
|
426
|
+
}, 2), (0, _jsxRuntime.jsx)(_uiA11yContent.AccessibleContent, {
|
|
430
427
|
alt: longDayNames[2],
|
|
431
428
|
children: shortDayNames[2]
|
|
432
|
-
}, 3), (0, _jsxRuntime.jsx)(
|
|
429
|
+
}, 3), (0, _jsxRuntime.jsx)(_uiA11yContent.AccessibleContent, {
|
|
433
430
|
alt: longDayNames[3],
|
|
434
431
|
children: shortDayNames[3]
|
|
435
|
-
}, 4), (0, _jsxRuntime.jsx)(
|
|
432
|
+
}, 4), (0, _jsxRuntime.jsx)(_uiA11yContent.AccessibleContent, {
|
|
436
433
|
alt: longDayNames[4],
|
|
437
434
|
children: shortDayNames[4]
|
|
438
|
-
}, 5), (0, _jsxRuntime.jsx)(
|
|
435
|
+
}, 5), (0, _jsxRuntime.jsx)(_uiA11yContent.AccessibleContent, {
|
|
439
436
|
alt: longDayNames[5],
|
|
440
437
|
children: shortDayNames[5]
|
|
441
|
-
}, 6), (0, _jsxRuntime.jsx)(
|
|
438
|
+
}, 6), (0, _jsxRuntime.jsx)(_uiA11yContent.AccessibleContent, {
|
|
442
439
|
alt: longDayNames[6],
|
|
443
440
|
children: shortDayNames[6]
|
|
444
441
|
}, 7)];
|
|
@@ -451,9 +448,9 @@ category: components
|
|
|
451
448
|
size: "small",
|
|
452
449
|
withBackground: false,
|
|
453
450
|
withBorder: false,
|
|
454
|
-
renderIcon: type === 'prev' ? (0, _jsxRuntime.jsx)(
|
|
451
|
+
renderIcon: type === 'prev' ? (0, _jsxRuntime.jsx)(_uiIcons.IconArrowOpenStartSolid, {
|
|
455
452
|
color: "primary"
|
|
456
|
-
}) : (0, _jsxRuntime.jsx)(
|
|
453
|
+
}) : (0, _jsxRuntime.jsx)(_uiIcons.IconArrowOpenEndSolid, {
|
|
457
454
|
color: "primary"
|
|
458
455
|
}),
|
|
459
456
|
screenReaderLabel: type === 'prev' ? this.props.prevMonthLabel : this.props.nextMonthLabel
|
|
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.DateTimeInput = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
9
|
-
var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
|
|
10
|
-
var _ApplyLocaleContext = require("@instructure/ui-i18n/lib/ApplyLocale/ApplyLocaleContext.js");
|
|
8
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
11
9
|
var _latest = require("@instructure/ui-form-field/latest");
|
|
12
10
|
var _latest2 = require("@instructure/ui-date-input/latest");
|
|
13
11
|
var _latest3 = require("@instructure/ui-time-select/latest");
|
|
@@ -57,7 +55,7 @@ category: components
|
|
|
57
55
|
isRequired: false,
|
|
58
56
|
allowNonStepInput: false
|
|
59
57
|
};
|
|
60
|
-
static contextType =
|
|
58
|
+
static contextType = _uiI18n.ApplyLocaleContext;
|
|
61
59
|
ref = null; // This is used by Tooltip for positioning
|
|
62
60
|
|
|
63
61
|
handleRef = el => {
|
|
@@ -90,11 +88,11 @@ category: components
|
|
|
90
88
|
recalculateState(dateStr, doNotChangeDate = false, doNotChangeTime = false) {
|
|
91
89
|
let errorMsg;
|
|
92
90
|
if (dateStr) {
|
|
93
|
-
const parsed =
|
|
91
|
+
const parsed = _uiI18n.DateTime.parse(dateStr, this.locale(), this.timezone());
|
|
94
92
|
if (parsed.isValid()) {
|
|
95
93
|
if (doNotChangeTime && this.state.timeSelectValue) {
|
|
96
94
|
// There is a selected time, adjust the parsed date to its value
|
|
97
|
-
const timeParsed =
|
|
95
|
+
const timeParsed = _uiI18n.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
98
96
|
parsed.hour(timeParsed.hour()).minute(timeParsed.minute());
|
|
99
97
|
}
|
|
100
98
|
if (doNotChangeDate && this.state.iso) {
|
|
@@ -157,7 +155,7 @@ category: components
|
|
|
157
155
|
} else if (this.context && this.context.locale) {
|
|
158
156
|
return this.context.locale;
|
|
159
157
|
}
|
|
160
|
-
return
|
|
158
|
+
return _uiI18n.Locale.browserLocale();
|
|
161
159
|
}
|
|
162
160
|
timezone() {
|
|
163
161
|
if (this.props.timezone) {
|
|
@@ -165,7 +163,7 @@ category: components
|
|
|
165
163
|
} else if (this.context && this.context.timezone) {
|
|
166
164
|
return this.context.timezone;
|
|
167
165
|
}
|
|
168
|
-
return
|
|
166
|
+
return _uiI18n.DateTime.browserTimeZone();
|
|
169
167
|
}
|
|
170
168
|
formatDateInput(date) {
|
|
171
169
|
const {
|
|
@@ -203,8 +201,8 @@ category: components
|
|
|
203
201
|
handleDateValidated = (event, _inputValue, utcDateString) => {
|
|
204
202
|
let newState;
|
|
205
203
|
if (utcDateString && this.state.timeSelectValue && (!this.state.dateInputText || this.state.dateInputText === '')) {
|
|
206
|
-
const timeParsed =
|
|
207
|
-
const dateParsed =
|
|
204
|
+
const timeParsed = _uiI18n.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
205
|
+
const dateParsed = _uiI18n.DateTime.parse(utcDateString, this.locale(), this.timezone());
|
|
208
206
|
const dateParsedAdjusted = dateParsed.set({
|
|
209
207
|
hour: timeParsed.hour(),
|
|
210
208
|
minute: timeParsed.minute()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-date-time-input",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.9-snapshot-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",
|
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/console": "11.7.
|
|
19
|
-
"@instructure/shared-types": "11.7.
|
|
20
|
-
"@instructure/ui-a11y-content": "11.7.
|
|
21
|
-
"@instructure/ui-calendar": "11.7.
|
|
22
|
-
"@instructure/ui-buttons": "11.7.
|
|
23
|
-
"@instructure/ui-
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-icons": "11.7.
|
|
27
|
-
"@instructure/ui-time-select": "11.7.
|
|
28
|
-
"@instructure/ui-react-utils": "11.7.
|
|
29
|
-
"@instructure/ui-utils": "11.7.
|
|
18
|
+
"@instructure/console": "11.7.9-snapshot-1",
|
|
19
|
+
"@instructure/shared-types": "11.7.9-snapshot-1",
|
|
20
|
+
"@instructure/ui-a11y-content": "11.7.9-snapshot-1",
|
|
21
|
+
"@instructure/ui-calendar": "11.7.9-snapshot-1",
|
|
22
|
+
"@instructure/ui-buttons": "11.7.9-snapshot-1",
|
|
23
|
+
"@instructure/ui-form-field": "11.7.9-snapshot-1",
|
|
24
|
+
"@instructure/ui-i18n": "11.7.9-snapshot-1",
|
|
25
|
+
"@instructure/ui-date-input": "11.7.9-snapshot-1",
|
|
26
|
+
"@instructure/ui-icons": "11.7.9-snapshot-1",
|
|
27
|
+
"@instructure/ui-time-select": "11.7.9-snapshot-1",
|
|
28
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-1",
|
|
29
|
+
"@instructure/ui-utils": "11.7.9-snapshot-1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"vitest": "^5.0.0",
|
|
33
|
-
"@instructure/ui-babel-preset": "11.7.
|
|
33
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": ">=18 <=19"
|