Skip to content

Commit

Permalink
Fix for invalid dates (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliasyishak authored Mar 31, 2023
1 parent aa82a08 commit a52b616
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.12.4]
* 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)

## [1.12.3]
* Added support for `routerConfig` to `MacosApp.router`. ([#388](https://github.com/macosui/macos_ui/issues/388))

Expand Down
12 changes: 10 additions & 2 deletions lib/src/selectors/date_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,13 @@ class _MacosDatePickerState extends State<MacosDatePicker> {
setState(() {
_selectedYear--;
_selectedMonth = 12;
_selectedDay = 1;
});
} else {
setState(() => _selectedMonth--);
setState(() {
_selectedMonth--;
_selectedDay = 1;
});
}
widget.onDateChanged.call(_formatAsDateTime());
},
Expand Down Expand Up @@ -397,9 +401,13 @@ class _MacosDatePickerState extends State<MacosDatePicker> {
setState(() {
_selectedYear++;
_selectedMonth = 1;
_selectedDay = 1;
});
} else {
setState(() => _selectedMonth++);
setState(() {
_selectedMonth++;
_selectedDay = 1;
});
}

widget.onDateChanged.call(_formatAsDateTime());
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: macos_ui
description: Flutter widgets and themes implementing the current macOS design language.
version: 1.12.3
version: 1.12.4
homepage: "https://macosui.dev"
repository: "https://github.com/GroovinChip/macos_ui"

Expand Down

0 comments on commit a52b616

Please sign in to comment.