Skip to content

Fix the 6-days-until-the-end-of-the-month bug

LRN requested to merge lrn/glib:six-days-to-eom into master

The addition causes the date to shift forward into 1st of the next month, because a 0-based offset is compared to be "more than" the days in the month instead of "more than or equal to".

This is triggered by corner-cases where transition date is 6 days off the end of the month and our calculations put it at N+1th day of the month (where N is the number of days in the month). The subtraction should be triggered to move the date back a week, putting it 6 days off the end; for example, October 25 for CET DST transition; but due to incorrect comparison the date isn't shifted back, we add 31 days to October 1st and end up at November 1st).

Fixes issue #2215 (closed).

Merge request reports