@instructure/ui-date-time-input 10.3.0 → 10.3.1-snapshot-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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
## [10.3.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v10.3.0...v10.3.1-snapshot-2) (2024-10-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui-calendar:** fix duplicate dates for certain timezones ([f9181aa](https://github.com/instructure/instructure-ui/commit/f9181aa88c35eba1e374240505d32bf618c46b04))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [10.3.0](https://github.com/instructure/instructure-ui/compare/v10.2.2...v10.3.0) (2024-10-03)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @instructure/ui-date-time-input
|
|
@@ -345,7 +345,21 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_DateTimeInput = class Da
|
|
|
345
345
|
const currDate = DateTime.getFirstDayOfWeek(renderedDate.startOf('month'));
|
|
346
346
|
const arr = [];
|
|
347
347
|
for (let i = 0; i < Calendar.DAY_COUNT; i++) {
|
|
348
|
-
|
|
348
|
+
// 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,
|
|
349
|
+
// in these cases adding 1 day results in 23 hours added instead,
|
|
350
|
+
// so `moment.tz('2024-09-07T00:00:00', 'America/Santiago').add({days: 1})` results
|
|
351
|
+
// in "Sat Sep 07 2024 23:00:00 GMT-0400" instead of "Sun Sep 08 2024 00:00:00 GMT-0400".
|
|
352
|
+
// which would cause duplicate dates in the calendar.
|
|
353
|
+
// More info on the bug: https://github.com/moment/moment/issues/4743
|
|
354
|
+
// Please note that this causes one hour of time difference in the affected timezones/dates and to
|
|
355
|
+
// fully solve this bug we need to change to something like luxon which handles this properly
|
|
356
|
+
if (currDate.clone().format('HH') === '23') {
|
|
357
|
+
arr.push(currDate.clone().add({
|
|
358
|
+
hours: 1
|
|
359
|
+
}));
|
|
360
|
+
} else {
|
|
361
|
+
arr.push(currDate.clone());
|
|
362
|
+
}
|
|
349
363
|
currDate.add({
|
|
350
364
|
days: 1
|
|
351
365
|
});
|
|
@@ -353,7 +353,21 @@ let DateTimeInput = exports.DateTimeInput = (_dec = (0, _testable.testable)(), _
|
|
|
353
353
|
const currDate = _DateTime.DateTime.getFirstDayOfWeek(renderedDate.startOf('month'));
|
|
354
354
|
const arr = [];
|
|
355
355
|
for (let i = 0; i < _Calendar.Calendar.DAY_COUNT; i++) {
|
|
356
|
-
|
|
356
|
+
// 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,
|
|
357
|
+
// in these cases adding 1 day results in 23 hours added instead,
|
|
358
|
+
// so `moment.tz('2024-09-07T00:00:00', 'America/Santiago').add({days: 1})` results
|
|
359
|
+
// in "Sat Sep 07 2024 23:00:00 GMT-0400" instead of "Sun Sep 08 2024 00:00:00 GMT-0400".
|
|
360
|
+
// which would cause duplicate dates in the calendar.
|
|
361
|
+
// More info on the bug: https://github.com/moment/moment/issues/4743
|
|
362
|
+
// Please note that this causes one hour of time difference in the affected timezones/dates and to
|
|
363
|
+
// fully solve this bug we need to change to something like luxon which handles this properly
|
|
364
|
+
if (currDate.clone().format('HH') === '23') {
|
|
365
|
+
arr.push(currDate.clone().add({
|
|
366
|
+
hours: 1
|
|
367
|
+
}));
|
|
368
|
+
} else {
|
|
369
|
+
arr.push(currDate.clone());
|
|
370
|
+
}
|
|
357
371
|
currDate.add({
|
|
358
372
|
days: 1
|
|
359
373
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-date-time-input",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.1-snapshot-2",
|
|
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,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "10.3.
|
|
27
|
-
"@instructure/ui-test-utils": "10.3.
|
|
26
|
+
"@instructure/ui-babel-preset": "10.3.1-snapshot-2",
|
|
27
|
+
"@instructure/ui-test-utils": "10.3.1-snapshot-2",
|
|
28
28
|
"@testing-library/jest-dom": "^6.4.6",
|
|
29
29
|
"@testing-library/react": "^16.0.1",
|
|
30
30
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -32,20 +32,20 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.25.6",
|
|
35
|
-
"@instructure/console": "10.3.
|
|
36
|
-
"@instructure/shared-types": "10.3.
|
|
37
|
-
"@instructure/ui-a11y-content": "10.3.
|
|
38
|
-
"@instructure/ui-buttons": "10.3.
|
|
39
|
-
"@instructure/ui-calendar": "10.3.
|
|
40
|
-
"@instructure/ui-date-input": "10.3.
|
|
41
|
-
"@instructure/ui-form-field": "10.3.
|
|
42
|
-
"@instructure/ui-i18n": "10.3.
|
|
43
|
-
"@instructure/ui-icons": "10.3.
|
|
44
|
-
"@instructure/ui-prop-types": "10.3.
|
|
45
|
-
"@instructure/ui-react-utils": "10.3.
|
|
46
|
-
"@instructure/ui-testable": "10.3.
|
|
47
|
-
"@instructure/ui-time-select": "10.3.
|
|
48
|
-
"@instructure/ui-utils": "10.3.
|
|
35
|
+
"@instructure/console": "10.3.1-snapshot-2",
|
|
36
|
+
"@instructure/shared-types": "10.3.1-snapshot-2",
|
|
37
|
+
"@instructure/ui-a11y-content": "10.3.1-snapshot-2",
|
|
38
|
+
"@instructure/ui-buttons": "10.3.1-snapshot-2",
|
|
39
|
+
"@instructure/ui-calendar": "10.3.1-snapshot-2",
|
|
40
|
+
"@instructure/ui-date-input": "10.3.1-snapshot-2",
|
|
41
|
+
"@instructure/ui-form-field": "10.3.1-snapshot-2",
|
|
42
|
+
"@instructure/ui-i18n": "10.3.1-snapshot-2",
|
|
43
|
+
"@instructure/ui-icons": "10.3.1-snapshot-2",
|
|
44
|
+
"@instructure/ui-prop-types": "10.3.1-snapshot-2",
|
|
45
|
+
"@instructure/ui-react-utils": "10.3.1-snapshot-2",
|
|
46
|
+
"@instructure/ui-testable": "10.3.1-snapshot-2",
|
|
47
|
+
"@instructure/ui-time-select": "10.3.1-snapshot-2",
|
|
48
|
+
"@instructure/ui-utils": "10.3.1-snapshot-2",
|
|
49
49
|
"prop-types": "^15.8.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -430,8 +430,21 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
430
430
|
const currDate = DateTime.getFirstDayOfWeek(renderedDate.startOf('month'))
|
|
431
431
|
const arr: Moment[] = []
|
|
432
432
|
for (let i = 0; i < Calendar.DAY_COUNT; i++) {
|
|
433
|
-
|
|
434
|
-
|
|
433
|
+
// 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,
|
|
434
|
+
// in these cases adding 1 day results in 23 hours added instead,
|
|
435
|
+
// so `moment.tz('2024-09-07T00:00:00', 'America/Santiago').add({days: 1})` results
|
|
436
|
+
// in "Sat Sep 07 2024 23:00:00 GMT-0400" instead of "Sun Sep 08 2024 00:00:00 GMT-0400".
|
|
437
|
+
// which would cause duplicate dates in the calendar.
|
|
438
|
+
// More info on the bug: https://github.com/moment/moment/issues/4743
|
|
439
|
+
// Please note that this causes one hour of time difference in the affected timezones/dates and to
|
|
440
|
+
// fully solve this bug we need to change to something like luxon which handles this properly
|
|
441
|
+
if (currDate.clone().format('HH') === '23') {
|
|
442
|
+
arr.push(currDate.clone().add({hours: 1}))
|
|
443
|
+
} else {
|
|
444
|
+
arr.push(currDate.clone())
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
currDate.add({days: 1})
|
|
435
448
|
}
|
|
436
449
|
return arr.map((date) => {
|
|
437
450
|
const dateStr = date.toISOString()
|