@instructure/ui-calendar 8.56.2 → 8.56.4

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,28 @@
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.56.4](https://github.com/instructure/instructure-ui/compare/v8.56.3...v8.56.4) (2024-10-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-calendar,ui-date-input:** fix locale and timezone for simple api ([94209df](https://github.com/instructure/instructure-ui/commit/94209dfdfaeca8c8ae452771c4bf2688e6345272))
12
+
13
+
14
+
15
+
16
+
17
+ ## [8.56.3](https://github.com/instructure/instructure-ui/compare/v8.56.2...v8.56.3) (2024-09-18)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **ui-calendar,ui-color-picker:** fix code to remove unnecessary warnings ([f111d2e](https://github.com/instructure/instructure-ui/commit/f111d2efd8873dbc3d2fd6653af2d39b9691de81))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [8.56.2](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2) (2024-08-06)
7
29
 
8
30
  **Note:** Version bump only for package @instructure/ui-calendar
@@ -235,9 +235,10 @@ let Calendar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
235
235
  }) : day))));
236
236
  }
237
237
  locale() {
238
+ var _this$context;
238
239
  if (this.props.locale) {
239
240
  return this.props.locale;
240
- } else if (this.context && this.context.locale) {
241
+ } else if (this !== null && this !== void 0 && (_this$context = this.context) !== null && _this$context !== void 0 && _this$context.locale) {
241
242
  return this.context.locale;
242
243
  }
243
244
  return Locale.browserLocale();
@@ -286,7 +287,7 @@ let Calendar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
286
287
  return jsx(Calendar.Day, {
287
288
  key: dateStr,
288
289
  date: dateStr,
289
- isSelected: selectedDate ? date.isSame(selectedDate, 'day') : false,
290
+ isSelected: selectedDate ? date.isSame(DateTime.parse(selectedDate, this.locale(), this.timezone()), 'day') : false,
290
291
  isToday: date.isSame(today, 'day'),
291
292
  isOutsideMonth: !date.isSame(visibleMonth, 'month'),
292
293
  label: date.format('D MMMM YYYY') // used by screen readers
@@ -246,9 +246,10 @@ let Calendar = exports.Calendar = (_dec = (0, _emotion.withStyle)(_styles.defaul
246
246
  }) : day))));
247
247
  }
248
248
  locale() {
249
+ var _this$context;
249
250
  if (this.props.locale) {
250
251
  return this.props.locale;
251
- } else if (this.context && this.context.locale) {
252
+ } else if (this !== null && this !== void 0 && (_this$context = this.context) !== null && _this$context !== void 0 && _this$context.locale) {
252
253
  return this.context.locale;
253
254
  }
254
255
  return _Locale.Locale.browserLocale();
@@ -297,7 +298,7 @@ let Calendar = exports.Calendar = (_dec = (0, _emotion.withStyle)(_styles.defaul
297
298
  return (0, _emotion.jsx)(Calendar.Day, {
298
299
  key: dateStr,
299
300
  date: dateStr,
300
- isSelected: selectedDate ? date.isSame(selectedDate, 'day') : false,
301
+ isSelected: selectedDate ? date.isSame(_DateTime.DateTime.parse(selectedDate, this.locale(), this.timezone()), 'day') : false,
301
302
  isToday: date.isSame(today, 'day'),
302
303
  isOutsideMonth: !date.isSame(visibleMonth, 'month'),
303
304
  label: date.format('D MMMM YYYY') // used by screen readers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-calendar",
3
- "version": "8.56.2",
3
+ "version": "8.56.4",
4
4
  "description": "A calendar component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,29 +23,29 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.56.2",
27
- "@instructure/ui-color-utils": "8.56.2",
28
- "@instructure/ui-test-locator": "8.56.2",
29
- "@instructure/ui-test-utils": "8.56.2",
30
- "@instructure/ui-themes": "8.56.2",
26
+ "@instructure/ui-babel-preset": "8.56.4",
27
+ "@instructure/ui-color-utils": "8.56.4",
28
+ "@instructure/ui-test-locator": "8.56.4",
29
+ "@instructure/ui-test-utils": "8.56.4",
30
+ "@instructure/ui-themes": "8.56.4",
31
31
  "@testing-library/jest-dom": "^6.1.4",
32
32
  "@testing-library/react": "^14.1.2"
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/runtime": "^7.23.2",
36
- "@instructure/console": "8.56.2",
37
- "@instructure/emotion": "8.56.2",
38
- "@instructure/shared-types": "8.56.2",
39
- "@instructure/ui-a11y-content": "8.56.2",
40
- "@instructure/ui-buttons": "8.56.2",
41
- "@instructure/ui-i18n": "8.56.2",
42
- "@instructure/ui-icons": "8.56.2",
43
- "@instructure/ui-prop-types": "8.56.2",
44
- "@instructure/ui-react-utils": "8.56.2",
45
- "@instructure/ui-testable": "8.56.2",
46
- "@instructure/ui-utils": "8.56.2",
47
- "@instructure/ui-view": "8.56.2",
48
- "@instructure/uid": "8.56.2",
36
+ "@instructure/console": "8.56.4",
37
+ "@instructure/emotion": "8.56.4",
38
+ "@instructure/shared-types": "8.56.4",
39
+ "@instructure/ui-a11y-content": "8.56.4",
40
+ "@instructure/ui-buttons": "8.56.4",
41
+ "@instructure/ui-i18n": "8.56.4",
42
+ "@instructure/ui-icons": "8.56.4",
43
+ "@instructure/ui-prop-types": "8.56.4",
44
+ "@instructure/ui-react-utils": "8.56.4",
45
+ "@instructure/ui-testable": "8.56.4",
46
+ "@instructure/ui-utils": "8.56.4",
47
+ "@instructure/ui-view": "8.56.4",
48
+ "@instructure/uid": "8.56.4",
49
49
  "prop-types": "^15.8.1"
50
50
  },
51
51
  "peerDependencies": {
@@ -342,7 +342,7 @@ class Calendar extends Component<CalendarProps, CalendarState> {
342
342
  locale(): string {
343
343
  if (this.props.locale) {
344
344
  return this.props.locale
345
- } else if (this.context && this.context.locale) {
345
+ } else if (this?.context?.locale) {
346
346
  return this.context.locale
347
347
  }
348
348
  return Locale.browserLocale()
@@ -401,7 +401,14 @@ class Calendar extends Component<CalendarProps, CalendarState> {
401
401
  <Calendar.Day
402
402
  key={dateStr}
403
403
  date={dateStr}
404
- isSelected={selectedDate ? date.isSame(selectedDate, 'day') : false}
404
+ isSelected={
405
+ selectedDate
406
+ ? date.isSame(
407
+ DateTime.parse(selectedDate, this.locale(), this.timezone()),
408
+ 'day'
409
+ )
410
+ : false
411
+ }
405
412
  isToday={date.isSame(today, 'day')}
406
413
  isOutsideMonth={!date.isSame(visibleMonth, 'month')}
407
414
  label={date.format('D MMMM YYYY')} // used by screen readers