diff --git a/CHANGELOG.md b/CHANGELOG.md index 51bbfc8..0a280f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 5.1.2 - 2024-08-20 +- Fixed [#104](https://github.com/Macacoazul01/month_picker_dialog/issues/104). + ## 5.1.1 - 2024-08-19 - Fixed [#105](https://github.com/Macacoazul01/month_picker_dialog/issues/105). diff --git a/example/lib/main.dart b/example/lib/main.dart index 8c2f8db..9efe331 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -142,8 +142,8 @@ class _MyAppState extends State { context: contexto, firstDate: DateTime(DateTime.now().year - 5, 5), lastDate: DateTime(DateTime.now().year + 8, 9), - initialRangeDate: DateTime(DateTime.now().year, 5), - endRangeDate: DateTime(DateTime.now().year, 7), + initialRangeDate: DateTime(DateTime.now().year - 1, 5), + endRangeDate: DateTime(DateTime.now().year - 1, 7), confirmWidget: Text( 'This one!', style: TextStyle( diff --git a/lib/src/helpers/controller.dart b/lib/src/helpers/controller.dart index f1b4c1c..c709dd9 100644 --- a/lib/src/helpers/controller.dart +++ b/lib/src/helpers/controller.dart @@ -53,7 +53,7 @@ class MonthpickerController { ///Function to initialize the controller when the dialog is created. void initialize() { - selectedDate = (initialDate ?? now).firstDayOfMonth()!; + selectedDate = (initialRangeDate ?? initialDate ?? now).firstDayOfMonth()!; if (firstDate != null) { localFirstDate = DateTime(firstDate!.year, firstDate!.month); } diff --git a/pubspec.yaml b/pubspec.yaml index 8e3e7c1..16dcf3e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: month_picker_dialog description: Internationalized dialog for picking a single month from an infinite list of years. -version: 5.1.1 +version: 5.1.2 homepage: https://github.com/hmkrivoj/month_picker_dialog environment: