[corlib] Fixes DST without AdjustmentRules.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Thu, 30 Apr 2015 12:35:24 +0000 (13:35 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Mon, 4 May 2015 14:43:51 +0000 (15:43 +0100)
Fixes IsDaylightSavingTime returning false when
SupportsDaylightSavingTime was set to false because TimeZoneInfo was
create with no AdjustmentRules.

Now if TimeZoneInfo uses transitions SupportsDaylightSavingTime will be
set to true regardless of AdjustmentRules.

mcs/class/corlib/System/TimeZoneInfo.cs

index 0c17412242c835af7107d559a158ce9be1e25444..4b82ab77416132a00d4a844f23d3a0f21ae453a8 100644 (file)
@@ -591,7 +591,7 @@ namespace System
 
                public AdjustmentRule [] GetAdjustmentRules ()
                {
-                       if (!supportsDaylightSavingTime)
+                       if (!supportsDaylightSavingTime || adjustmentRules == null)
                                return new AdjustmentRule [0];
                        else
                                return (AdjustmentRule []) adjustmentRules.Clone ();
@@ -1319,8 +1319,10 @@ namespace System
                                tz = CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName, daylightDisplayName, ValidateRules (adjustmentRules).ToArray ());
                        }
 
-                       if (storeTransition)
+                       if (storeTransition && transitions.Count > 0) {
                                tz.transitions = transitions;
+                               tz.supportsDaylightSavingTime = true;
+                       }
 
                        return tz;
                }