@instructure/ui-calendar 9.6.1-snapshot-2 → 9.7.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 CHANGED
@@ -3,7 +3,7 @@
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
- ## [9.6.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v9.6.0...v9.6.1-snapshot-2) (2024-09-06)
6
+ ## [9.7.1](https://github.com/instructure/instructure-ui/compare/v9.7.0...v9.7.1) (2024-10-10)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-calendar
9
9
 
@@ -11,6 +11,22 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
+ # [9.7.0](https://github.com/instructure/instructure-ui/compare/v9.6.0...v9.7.0) (2024-09-23)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **ui-calendar:** fix code to remove unnecessary warnings ([d139bd4](https://github.com/instructure/instructure-ui/commit/d139bd4e6f156744d5bd4f2fb6e7acacf58804d6))
20
+
21
+
22
+ ### Features
23
+
24
+ * **ui-date-input:** improve DateInput2 api, extend docs ([f369604](https://github.com/instructure/instructure-ui/commit/f3696040d59f9baf9b9a27070e6fbc3d458e4495))
25
+
26
+
27
+
28
+
29
+
14
30
  # [9.6.0](https://github.com/instructure/instructure-ui/compare/v9.5.2...v9.6.0) (2024-08-14)
15
31
 
16
32
 
@@ -182,7 +182,7 @@ let Calendar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
182
182
  }
183
183
  get hasNextMonth() {
184
184
  // this is needed for locales that doesn't use the latin script for numbers e.g.: arabic
185
- const yearNumber = Number(this.state.visibleMonth.clone().locale('en').subtract({
185
+ const yearNumber = Number(this.state.visibleMonth.clone().locale('en').add({
186
186
  months: 1
187
187
  }).format('YYYY'));
188
188
  return !this.props.withYearPicker || this.props.withYearPicker && yearNumber <= this.props.withYearPicker.endYear;
@@ -216,6 +216,7 @@ let Calendar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
216
216
  }, jsx(SimpleSelect, {
217
217
  width: "90px",
218
218
  renderLabel: "",
219
+ placeholder: "--",
219
220
  assistiveText: withYearPicker.screenReaderLabel,
220
221
  value: visibleMonth.format('YYYY'),
221
222
  onChange: (e, {
@@ -345,7 +346,7 @@ let Calendar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
345
346
  return jsx(Calendar.Day, {
346
347
  key: dateStr,
347
348
  date: dateStr,
348
- isSelected: selectedDate ? date.isSame(selectedDate, 'day') : false,
349
+ isSelected: selectedDate ? date.isSame(DateTime.parse(selectedDate, this.locale(), this.timezone()), 'day') : false,
349
350
  isToday: date.isSame(today, 'day'),
350
351
  isOutsideMonth: !date.isSame(visibleMonth, 'month'),
351
352
  label: date.format('D MMMM YYYY') // used by screen readers
@@ -193,7 +193,7 @@ let Calendar = exports.Calendar = (_dec = (0, _emotion.withStyle)(_styles.defaul
193
193
  }
194
194
  get hasNextMonth() {
195
195
  // this is needed for locales that doesn't use the latin script for numbers e.g.: arabic
196
- const yearNumber = Number(this.state.visibleMonth.clone().locale('en').subtract({
196
+ const yearNumber = Number(this.state.visibleMonth.clone().locale('en').add({
197
197
  months: 1
198
198
  }).format('YYYY'));
199
199
  return !this.props.withYearPicker || this.props.withYearPicker && yearNumber <= this.props.withYearPicker.endYear;
@@ -227,6 +227,7 @@ let Calendar = exports.Calendar = (_dec = (0, _emotion.withStyle)(_styles.defaul
227
227
  }, (0, _emotion.jsx)(_SimpleSelect.SimpleSelect, {
228
228
  width: "90px",
229
229
  renderLabel: "",
230
+ placeholder: "--",
230
231
  assistiveText: withYearPicker.screenReaderLabel,
231
232
  value: visibleMonth.format('YYYY'),
232
233
  onChange: (e, {
@@ -356,7 +357,7 @@ let Calendar = exports.Calendar = (_dec = (0, _emotion.withStyle)(_styles.defaul
356
357
  return (0, _emotion.jsx)(Calendar.Day, {
357
358
  key: dateStr,
358
359
  date: dateStr,
359
- isSelected: selectedDate ? date.isSame(selectedDate, 'day') : false,
360
+ isSelected: selectedDate ? date.isSame(_DateTime.DateTime.parse(selectedDate, this.locale(), this.timezone()), 'day') : false,
360
361
  isToday: date.isSame(today, 'day'),
361
362
  isOutsideMonth: !date.isSame(visibleMonth, 'month'),
362
363
  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": "9.6.1-snapshot-2",
3
+ "version": "9.7.1",
4
4
  "description": "A calendar component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,31 +23,31 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "9.6.1-snapshot-2",
27
- "@instructure/ui-color-utils": "9.6.1-snapshot-2",
28
- "@instructure/ui-test-locator": "9.6.1-snapshot-2",
29
- "@instructure/ui-test-utils": "9.6.1-snapshot-2",
30
- "@instructure/ui-themes": "9.6.1-snapshot-2",
26
+ "@instructure/ui-babel-preset": "9.7.1",
27
+ "@instructure/ui-color-utils": "9.7.1",
28
+ "@instructure/ui-test-locator": "9.7.1",
29
+ "@instructure/ui-test-utils": "9.7.1",
30
+ "@instructure/ui-themes": "9.7.1",
31
31
  "@testing-library/jest-dom": "^6.4.6",
32
32
  "@testing-library/react": "^15.0.7",
33
33
  "vitest": "^2.0.2"
34
34
  },
35
35
  "dependencies": {
36
36
  "@babel/runtime": "^7.24.5",
37
- "@instructure/console": "9.6.1-snapshot-2",
38
- "@instructure/emotion": "9.6.1-snapshot-2",
39
- "@instructure/shared-types": "9.6.1-snapshot-2",
40
- "@instructure/ui-a11y-content": "9.6.1-snapshot-2",
41
- "@instructure/ui-buttons": "9.6.1-snapshot-2",
42
- "@instructure/ui-i18n": "9.6.1-snapshot-2",
43
- "@instructure/ui-icons": "9.6.1-snapshot-2",
44
- "@instructure/ui-prop-types": "9.6.1-snapshot-2",
45
- "@instructure/ui-react-utils": "9.6.1-snapshot-2",
46
- "@instructure/ui-simple-select": "9.6.1-snapshot-2",
47
- "@instructure/ui-testable": "9.6.1-snapshot-2",
48
- "@instructure/ui-utils": "9.6.1-snapshot-2",
49
- "@instructure/ui-view": "9.6.1-snapshot-2",
50
- "@instructure/uid": "9.6.1-snapshot-2",
37
+ "@instructure/console": "9.7.1",
38
+ "@instructure/emotion": "9.7.1",
39
+ "@instructure/shared-types": "9.7.1",
40
+ "@instructure/ui-a11y-content": "9.7.1",
41
+ "@instructure/ui-buttons": "9.7.1",
42
+ "@instructure/ui-i18n": "9.7.1",
43
+ "@instructure/ui-icons": "9.7.1",
44
+ "@instructure/ui-prop-types": "9.7.1",
45
+ "@instructure/ui-react-utils": "9.7.1",
46
+ "@instructure/ui-simple-select": "9.7.1",
47
+ "@instructure/ui-testable": "9.7.1",
48
+ "@instructure/ui-utils": "9.7.1",
49
+ "@instructure/ui-view": "9.7.1",
50
+ "@instructure/uid": "9.7.1",
51
51
  "prop-types": "^15.8.1"
52
52
  },
53
53
  "peerDependencies": {
@@ -166,7 +166,7 @@ class Calendar extends Component<CalendarProps, CalendarState> {
166
166
  this.state.visibleMonth
167
167
  .clone()
168
168
  .locale('en')
169
- .subtract({ months: 1 })
169
+ .add({ months: 1 })
170
170
  .format('YYYY')
171
171
  )
172
172
  return (
@@ -318,6 +318,7 @@ class Calendar extends Component<CalendarProps, CalendarState> {
318
318
  <SimpleSelect
319
319
  width="90px"
320
320
  renderLabel=""
321
+ placeholder="--"
321
322
  assistiveText={withYearPicker.screenReaderLabel}
322
323
  value={visibleMonth.format('YYYY')}
323
324
  onChange={(
@@ -509,7 +510,14 @@ class Calendar extends Component<CalendarProps, CalendarState> {
509
510
  <Calendar.Day
510
511
  key={dateStr}
511
512
  date={dateStr}
512
- isSelected={selectedDate ? date.isSame(selectedDate, 'day') : false}
513
+ isSelected={
514
+ selectedDate
515
+ ? date.isSame(
516
+ DateTime.parse(selectedDate, this.locale(), this.timezone()),
517
+ 'day'
518
+ )
519
+ : false
520
+ }
513
521
  isToday={date.isSame(today, 'day')}
514
522
  isOutsideMonth={!date.isSame(visibleMonth, 'month')}
515
523
  label={date.format('D MMMM YYYY')} // used by screen readers