astorDev / Astor.Background

0 stars 0 forks source link

Incorrect time convertation on negative timeZoneShift #72

Closed centumsatem closed 2 years ago

centumsatem commented 3 years ago

ActionSchedule.ToTimesActionOrNull The current logic in switch is actually equivalent to t.Add(TimeSpan.FromHours(timezoneShift) It gives negative time on negative timezoneShift having abs value exceeding t.Hours. For example t = "00:15", timeZoneShift = -3, we get "-02:45", so the timer never runs. It should be like t => t.Add(TimeSpan.FromHours(timezoneShift + (timezoneShift < -t.Hours ? 24 : 0)))

astorDev commented 2 years ago

@centumsatem I finally was able to address the problem. I've actually applied the code to the piece you suggested and covered it with some tests. However, I haven't published a new image with the fix. If you need it, please let me know