Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selecting the last date in DateRangePicker.showDatePicker throws assert error in MonthPicker #18

Open
olaide-ekolere opened this issue Jun 21, 2019 · 2 comments

Comments

@olaide-ekolere
Copy link

olaide-ekolere commented Jun 21, 2019

Hi,
This is my code
var picked = await DateRagePicker.showDatePicker(
context: context,
initialFirstDate: DateTime.fromMillisecondsSinceEpoch(
_flightSearch.itineraries[0].departureDate),
initialLastDate: (DateTime.fromMillisecondsSinceEpoch(
_flightSearch.itineraries[1].departureDate)),
firstDate: DateTime.now().add(Duration(days: -1)) ,
lastDate: tenYears,
);
when the picker is opened and the user selects the last year and the last date, MonthPickers " assert(!selectedFirstDate.isBefore(firstDate) &&
(selectedLastDate == null || !selectedLastDate.isAfter(lastDate)))" is fired.

@msemera-dev
Copy link

I have the same problem.

@lisimmo
Copy link

lisimmo commented Apr 9, 2020

I observed this problem whenever I pick a different year (especially the last year) then tried to select a date. It seems the selectedLastDate becomes greater than the widget.lastDate

The hack I came up with was to

  1. Make a copy of the date_range_picker.dart file
  2. do a conditional if check and re-assign the selectLastDate if it's greater than the widget last date.

Screenshot 2020-04-09 at 1 50 42 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants