Hi! We noticed an issue regarding the display of the calendar weeks. This is related to daylight saving time (we are based in Chile, where we set our clocks back the first week of April). Here is proof of the issue when compiling the provided example:
This is a problem that occurs across years. The previous example was of the year 2023, and the following is of 2025:
We found that the main error was that the first week of April was broken apart into two different weeks. On closer inspection, it turned out that the reason for this was our local daylight saving time change, which occurs on the first Saturday of April. On the _lastDayofWeek method, when doing the following operation:
firstDayOfWeek.add(Duration(days: restOfWeek))
instead of returning the correct date at 00:00, it returns the previous day at 23:00, because during that week we turn our clocks back one hour. Our proposed solution handles this by using a new method to add days that makes sure to just add the correct number of days and doesn't make time adjustments. By using this method, the problem is solved:
Hi! We noticed an issue regarding the display of the calendar weeks. This is related to daylight saving time (we are based in Chile, where we set our clocks back the first week of April). Here is proof of the issue when compiling the provided example:
This is a problem that occurs across years. The previous example was of the year 2023, and the following is of 2025:
We found that the main error was that the first week of April was broken apart into two different weeks. On closer inspection, it turned out that the reason for this was our local daylight saving time change, which occurs on the first Saturday of April. On the
_lastDayofWeek
method, when doing the following operation:firstDayOfWeek.add(Duration(days: restOfWeek))
instead of returning the correct date at 00:00, it returns the previous day at 23:00, because during that week we turn our clocks back one hour. Our proposed solution handles this by using a new method to add days that makes sure to just add the correct number of days and doesn't make time adjustments. By using this method, the problem is solved: