From e0278f8f690085a3017a2ab460675365abe7a6df Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Wed, 14 Jan 2015 14:47:45 +0000 Subject: [PATCH] [System.Core] Fixed wrong DST of TimeZoneInfo with floating date rules. 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. --- mcs/class/System.Core/System/TimeZoneInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcs/class/System.Core/System/TimeZoneInfo.cs b/mcs/class/System.Core/System/TimeZoneInfo.cs index 5db5889419aa..67be127e4d38 100644 --- a/mcs/class/System.Core/System/TimeZoneInfo.cs +++ b/mcs/class/System.Core/System/TimeZoneInfo.cs @@ -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)