date_utils
date_utils copied to clipboard
Bug in daysInMonth - wrong startdate when date is a sunday
I noticed that when the first weekday is a sunday an extra week is added in front.
The fix is to do a modulus on the daysBefore so if it is a sunday the remainder is zero and zero is subtracted.
date_utils:32 firstToDisplay = first.subtract(new Duration(days: daysBefore % 7));
With this fix the days now align with Microsoft Outlook monthly calendar as well as Google calendar monthly calendar