@instructure/ui-date-input 10.3.1-snapshot-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,9 +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
- ## [10.3.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v10.3.0...v10.3.1-snapshot-0) (2024-10-04)
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
7
 
8
- **Note:** Version bump only for package @instructure/ui-date-input
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-calendar:** fix duplicate dates for certain timezones ([f9181aa](https://github.com/instructure/instructure-ui/commit/f9181aa88c35eba1e374240505d32bf618c46b04))
9
12
 
10
13
 
11
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-date-input",
3
- "version": "10.3.1-snapshot-0",
3
+ "version": "10.3.1-snapshot-2",
4
4
  "description": "A UI component library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-axe-check": "10.3.1-snapshot-0",
27
- "@instructure/ui-babel-preset": "10.3.1-snapshot-0",
28
- "@instructure/ui-buttons": "10.3.1-snapshot-0",
29
- "@instructure/ui-scripts": "10.3.1-snapshot-0",
30
- "@instructure/ui-test-utils": "10.3.1-snapshot-0",
26
+ "@instructure/ui-axe-check": "10.3.1-snapshot-2",
27
+ "@instructure/ui-babel-preset": "10.3.1-snapshot-2",
28
+ "@instructure/ui-buttons": "10.3.1-snapshot-2",
29
+ "@instructure/ui-scripts": "10.3.1-snapshot-2",
30
+ "@instructure/ui-test-utils": "10.3.1-snapshot-2",
31
31
  "@testing-library/jest-dom": "^6.4.6",
32
32
  "@testing-library/react": "^16.0.1",
33
33
  "@testing-library/user-event": "^14.5.2",
@@ -35,20 +35,20 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@babel/runtime": "^7.25.6",
38
- "@instructure/emotion": "10.3.1-snapshot-0",
39
- "@instructure/shared-types": "10.3.1-snapshot-0",
40
- "@instructure/ui-calendar": "10.3.1-snapshot-0",
41
- "@instructure/ui-form-field": "10.3.1-snapshot-0",
42
- "@instructure/ui-i18n": "10.3.1-snapshot-0",
43
- "@instructure/ui-icons": "10.3.1-snapshot-0",
44
- "@instructure/ui-popover": "10.3.1-snapshot-0",
45
- "@instructure/ui-position": "10.3.1-snapshot-0",
46
- "@instructure/ui-prop-types": "10.3.1-snapshot-0",
47
- "@instructure/ui-react-utils": "10.3.1-snapshot-0",
48
- "@instructure/ui-selectable": "10.3.1-snapshot-0",
49
- "@instructure/ui-testable": "10.3.1-snapshot-0",
50
- "@instructure/ui-text-input": "10.3.1-snapshot-0",
51
- "@instructure/ui-utils": "10.3.1-snapshot-0",
38
+ "@instructure/emotion": "10.3.1-snapshot-2",
39
+ "@instructure/shared-types": "10.3.1-snapshot-2",
40
+ "@instructure/ui-calendar": "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-popover": "10.3.1-snapshot-2",
45
+ "@instructure/ui-position": "10.3.1-snapshot-2",
46
+ "@instructure/ui-prop-types": "10.3.1-snapshot-2",
47
+ "@instructure/ui-react-utils": "10.3.1-snapshot-2",
48
+ "@instructure/ui-selectable": "10.3.1-snapshot-2",
49
+ "@instructure/ui-testable": "10.3.1-snapshot-2",
50
+ "@instructure/ui-text-input": "10.3.1-snapshot-2",
51
+ "@instructure/ui-utils": "10.3.1-snapshot-2",
52
52
  "moment-timezone": "^0.5.45",
53
53
  "prop-types": "^15.8.1"
54
54
  },
@@ -41,8 +41,21 @@ class Example extends React.Component {
41
41
 
42
42
  return Array.apply(null, Array(Calendar.DAY_COUNT)).map(() => {
43
43
  const currentDate = date.clone()
44
- date.add(1, 'days')
45
- return currentDate
44
+ date.add({days: 1})
45
+
46
+ // 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,
47
+ // in these cases adding 1 day results in 23 hours added instead,
48
+ // so `moment.tz('2024-09-07T00:00:00', 'America/Santiago').add({days: 1})` results
49
+ // in "Sat Sep 07 2024 23:00:00 GMT-0400" instead of "Sun Sep 08 2024 00:00:00 GMT-0400".
50
+ // which would cause duplicate dates in the calendar.
51
+ // More info on the bug: https://github.com/moment/moment/issues/4743
52
+ // Please note that this causes one hour of time difference in the affected timezones/dates and to
53
+ // fully solve this bug we need to change to something like luxon which handles this properly
54
+ if (currentDate.clone().format('HH') === '23') {
55
+ return currentDate.clone().add({hours: 1})
56
+ }
57
+
58
+ return currentDate.clone()
46
59
  })
47
60
  }
48
61