-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
When calculating a zman, the code first calculates the time in UTC and then adjusts for the local timezone offset.
If you calculate a zman for a location that is not yet DST while UTC is already in DST or the reverse the zmanim are off by an hour. (e.g. the last day of standard time in Los Angeles, in UTC it is already DST, same goes for first day of DST in Australia)
I added the following code in my project to account for this
var newTime = utcDateTime.AddMilliseconds(localOffset);
var utcDst = DateWithLocation.Location.TimeZone.IsDaylightSavingTime(utcDateTime);
var newDst = DateWithLocation.Location.TimeZone.IsDaylightSavingTime(newTime);
if (utcDst != newDst)
{
newTime = newTime.AddHours(newDst ? 1 : -1);
}
return newTime;
Metadata
Metadata
Assignees
Labels
No labels