Skip to content

Commit

Permalink
[System.Core] Fixed wrong DST of TimeZoneInfo with floating date rules.
Browse files Browse the repository at this point in the history
Fixes #26008
We do not want (transition.DayOfWeek - first) % 7 to be negative.
As (transition.DayOfWeek - first) cannot be lower than -7, adding 7 to it solves the issue.
  • Loading branch information
esdrubal committed Jan 14, 2015
1 parent e4676f8 commit e0278f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mcs/class/System.Core/System/TimeZoneInfo.cs
Expand Up @@ -1086,7 +1086,7 @@ private static DateTime TransitionPoint (TransitionTime transition, int year)
return new DateTime (year, transition.Month, transition.Day) + transition.TimeOfDay.TimeOfDay;

DayOfWeek first = (new DateTime (year, transition.Month, 1)).DayOfWeek;
int day = 1 + (transition.Week - 1) * 7 + (transition.DayOfWeek - first) % 7;
int day = 1 + (transition.Week - 1) * 7 + (transition.DayOfWeek - first + 7) % 7;
if (day > DateTime.DaysInMonth (year, transition.Month))
day -= 7;
if (day < 1)
Expand Down

0 comments on commit e0278f8

Please sign in to comment.