Skip to content

Commit a52b616

Browse files
authored
Fix for invalid dates (#402)
1 parent aa82a08 commit a52b616

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## [1.12.4]
2+
* Default the `_selectedDay` state variable to be 1 when selecting the previous/next month from widget to ensure new date is valid for `_formatAsDateTime()` method (https://github.com/flutter/flutter/issues/123669 & https://github.com/macosui/macos_ui/pull/402)
3+
14
## [1.12.3]
25
* Added support for `routerConfig` to `MacosApp.router`. ([#388](https://github.com/macosui/macos_ui/issues/388))
36

lib/src/selectors/date_picker.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,13 @@ class _MacosDatePickerState extends State<MacosDatePicker> {
354354
setState(() {
355355
_selectedYear--;
356356
_selectedMonth = 12;
357+
_selectedDay = 1;
357358
});
358359
} else {
359-
setState(() => _selectedMonth--);
360+
setState(() {
361+
_selectedMonth--;
362+
_selectedDay = 1;
363+
});
360364
}
361365
widget.onDateChanged.call(_formatAsDateTime());
362366
},
@@ -397,9 +401,13 @@ class _MacosDatePickerState extends State<MacosDatePicker> {
397401
setState(() {
398402
_selectedYear++;
399403
_selectedMonth = 1;
404+
_selectedDay = 1;
400405
});
401406
} else {
402-
setState(() => _selectedMonth++);
407+
setState(() {
408+
_selectedMonth++;
409+
_selectedDay = 1;
410+
});
403411
}
404412

405413
widget.onDateChanged.call(_formatAsDateTime());

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: macos_ui
22
description: Flutter widgets and themes implementing the current macOS design language.
3-
version: 1.12.3
3+
version: 1.12.4
44
homepage: "https://macosui.dev"
55
repository: "https://github.com/GroovinChip/macos_ui"
66

0 commit comments

Comments
 (0)