diff --git a/net-core/Ical.Net/CalendarComponents/VTimeZone.cs b/net-core/Ical.Net/CalendarComponents/VTimeZone.cs index b3883c3c7..14b91622b 100644 --- a/net-core/Ical.Net/CalendarComponents/VTimeZone.cs +++ b/net-core/Ical.Net/CalendarComponents/VTimeZone.cs @@ -44,7 +44,7 @@ public static VTimeZone FromDateTimeZone(string tzId, DateTime earlistDateTimeTo // Only include historical data if asked to do so. Otherwise, // use only the most recent adjustment rules available. var intervals = vTimeZone._nodaZone.GetZoneIntervals(earliest, Instant.FromDateTimeOffset(DateTimeOffset.Now)) - .Where(z => z.HasStart && z.Start != Instant.MinValue && z.HasEnd) + .Where(z => z.HasStart && z.Start != Instant.MinValue) .ToList(); var matchingDaylightIntervals = new List(); @@ -75,7 +75,7 @@ public static VTimeZone FromDateTimeZone(string tzId, DateTime earlistDateTimeTo vTimeZone.AddChild(latestStandardTimeZoneInfo); // check to see if there is no active, future daylight savings (ie, America/Phoenix) - if (latestStandardInterval != null && latestStandardInterval.End != Instant.MaxValue) + if (latestStandardInterval != null && (latestStandardInterval.HasEnd ? latestStandardInterval.End : Instant.MaxValue) != Instant.MaxValue) { //daylight var daylightIntervals = intervals.Where(x => x.Savings.ToTimeSpan() != new TimeSpan(0)).ToList(); @@ -130,7 +130,7 @@ private static VTimeZoneInfo CreateTimeZoneInfo(List matchedInterv throw new InvalidOperationException("oldestInterval was not found"); } - var previousInterval = intervals.SingleOrDefault(x => x.End == oldestInterval.Start); + var previousInterval = intervals.SingleOrDefault(x => (x.HasEnd ? x.End : Instant.MaxValue) == oldestInterval.Start); var delta = new TimeSpan(1, 0, 0);