Bug in SF Calendar minDate

So it seems ive run into an issue with the sf calendar on our production application that I cant seem to mitigate. If minDate is set to now and initialSelectedDate is set to now, whenever I click a date outside of the current month we are in, it bumps me back to the minDate as the current selected date of the sf calendar. Please do let me know if you see any idiotic errors in my code as this is a last resort for help.
```
SfCalendar(
headerHeight: 60,
minDate: DateTime.now().add(Duration(days: 365)),
onTap: (CalendarTapDetails details) {

setState(() {
_current_datetime = details.date;
//pass in the date to this method
//search the hasAvailableSpots array for the date
//if it does, then the clicked date has reservations (not enough to make it a black out) for that day
//get the value from the key weve looked up in the map
//subtract that value from the number or max anglers allowed to update the current number of anglers allowed text on the date screen
String date = DateFormat("[yyyy-MM-dd]").format(_current_datetime);
//return the elemenet tapped
//will set num current anglers allowed to max num anglers allowed minus the number returned from how many spots are left for that property on that day
number_of_current_anglers_allowed_for_date = widget.property.maxNumberOfAnglersAllowed - _getHowManySpotsAreLeftForThatDay(date);
});

},
blackoutDates: black_out_dates,
blackoutDatesTextStyle: TextStyle(
fontWeight: FontWeight.w400,

fontSize: 13,
color: Colors.red,
decoration: TextDecoration.lineThrough),
view: CalendarView.month,
firstDayOfWeek: 7,
dataSource: MeetingDataSource(_getDataSource()),
initialSelectedDate: DateTime.now(),
showNavigationArrow: true,
monthViewSettings: MonthViewSettings(
monthCellStyle: MonthCellStyle(
textStyle: TextStyle(fontWeight: FontWeight.w400, color: Colors.black),
trailingDatesTextStyle: TextStyle(fontWeight: FontWeight.w100, color: Colors.black),
leadingDatesTextStyle: TextStyle(fontWeight: FontWeight.w100, color: Colors.black),
),
navigationDirection: MonthNavigationDirection.vertical,
showTrailingAndLeadingDates: true,
// numberOfWeeksInView:4,
dayFormat: 'EEE',
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
),
),
```

10 Replies 1 reply marked as answer

IR Indumathi Ravichandran Syncfusion Team January 18, 2021 12:43 PM UTC

Hi Jacob, 
 
Thank you for your contacting Syncfusion support. 
 
We have already found and fixed the mentioned issue “Calendar moves to initialDisplayDate when click date out of the current month in Month view”. We will include the issue fix in our upcoming Weekly Nuget release package, which is expected to be rolled out by January 19, 2021 and let you know once the release rolled out. We appreciate your patience until then. 
 
Regards, 
Indumathi R 



IR Indumathi Ravichandran Syncfusion Team January 19, 2021 02:58 PM UTC

Hi Jacob, 
 
Thank you for your patience. 
 
We have included the mentioned issue fix for “Calendar moves to initialDisplayDate when click date out of the current month in Month view” in our latest Weekly Nuget package. Kindly update the Flutter calendar package to latest version 18.4.35 for resolving this issue. Please find the latest version from the following link. 
 
 
Regards, 
Indumathi R 


Marked as answer

JN Jacob Nehama January 20, 2021 03:37 AM UTC

Thanks so much for your feedback,

     Ive updated and it looks like the initial bug has been fixed but it has created another bug that is related.... if you have minDate set to DateTime.now() (have tried with plus or minus a few hours/days to see if that would work but no) and you scroll to a different month of the sf calendar, select a date, and then select the initial minDate that you have set (DateTime.now() in my case)/or any other date that is in the same month as the minDate, all of the displayed appointments that are on the calendar (from the CalendarDataSource) will be removed. If I use the default appointmentDisplayMode, the displayed appt markers (dots) are not removed. Im using this appointment display mode: MonthAppointmentDisplayMode.appointment. 

Best,

SfCalendar(
headerHeight: 60,
// minDate: DateTime.now().subtract(Duration(hours: 12)),
minDate: DateTime.now()),

maxDate: DateTime.now().add(Duration(days: 365)),
onTap: (CalendarTapDetails details) {

setState(() {
_current_datetime = details.date;

String date = DateFormat("[yyyy-MM-dd]").format(_current_datetime);


number_of_current_anglers_allowed_for_date = widget.property.maxNumberOfAnglersAllowed - _getHowManySpotsAreLeftForThatDay(date);
});

},
blackoutDates: black_out_dates,
blackoutDatesTextStyle: TextStyle(
fontWeight: FontWeight.w400,

fontSize: 13,
color: Colors.red,
decoration: TextDecoration.lineThrough),
view: CalendarView.month,
firstDayOfWeek: 7,
dataSource: MeetingDataSource(_getDataSource()),
initialSelectedDate: DateTime.now(),
showNavigationArrow: true,
monthViewSettings: MonthViewSettings(
monthCellStyle: MonthCellStyle(
textStyle: TextStyle(fontWeight: FontWeight.w400, color: Colors.black),
trailingDatesTextStyle: TextStyle(fontWeight: FontWeight.w100, color: Colors.black),
leadingDatesTextStyle: TextStyle(fontWeight: FontWeight.w100, color: Colors.black),
),
navigationDirection: MonthNavigationDirection.vertical,
showTrailingAndLeadingDates: true,
dayFormat: 'EEE',
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
),
),


IR Indumathi Ravichandran Syncfusion Team January 20, 2021 12:54 PM UTC

Hi Jacob, 
 
Thank you for the update. 
 
Currently, we are validating the issue “Calendar appointments was cleared when setting the minDate value as DateTime.now() and select that date”. We will validate and update you with further details on or before January 22, 2021. We appreciate your patience until then. 
 
Regards, 
Indumathi R  



IR Indumathi Ravichandran Syncfusion Team January 22, 2021 05:26 AM UTC

Hi Jacob, 
 
Thank you for your patience. 
 
We have found and fixed the mentioned issue “Calendar appointments was cleared when setting the minDate value as DateTime.now() and select that date”. We will include the issue fix in our upcoming 2020 Volume 4 SP1 release, which is expected to be rolled by January 27, 2021 and let you know once the release rolled out. We appreciate your patience until then. 
 
Regards, 
Indumathi R 



JN Jacob Nehama January 22, 2021 07:01 AM UTC

Thank you so much for your great work. Excited to test it out once you guys push the update. Please credit me in the repo if you can!


IR Indumathi Ravichandran Syncfusion Team January 22, 2021 09:19 AM UTC

Hi Jacob, 
 
Thank you for the update. We will let you know once the release rolled out. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Indumathi R  



IR Indumathi Ravichandran Syncfusion Team January 28, 2021 09:52 AM UTC

Hi Jacob, 
 
Thank you for your patience. 
 
We are glad to announce that our 2020 Volume 4 Service Pack Release v18.4.39 is rolled out with the mentioned issue fix “Calendar appointments was cleared when setting the minDate value as DateTime.now() and select that date”. Kindly update to the mentioned version for resolving this issue fix. Also please find the latest version from the following link. 
 
  
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Indumathi R 



JN Jacob Nehama January 29, 2021 12:42 AM UTC

Indumathi, 

This latest release has done the trick. Functionality is working as expected. Thanks for the quick work as were looking to launch our first prod version in less than a month. It has been a pleasure. Closing this.

Best, 

Jacob Nehama


IR Indumathi Ravichandran Syncfusion Team January 29, 2021 05:03 AM UTC

Hi Jacob, 
 
Thank you for the update. 
 
We are glad to know that the issue resolved at your end. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Indumathi R 


Loader.
Up arrow icon