Quartz.NET - Shouldn't this unit test pass?

假装没事ソ 提交于 2019-11-30 15:35:31

I figured out that this actually is a bug in Quartz.NET 2.0.1, but it has already been fixed in 2.1.0.

I checked the change-log on the site, which does not mention a related fix. The comment from Peter Ritchie encouraged me to take another look at the newer Quartz versions. When i looked through the commits in the repository i noticed there actually was a fix for this.

It has been fixed in revision 665:

Merge pull request #72 from amazing-andrew/master
Time zone issues with CronExpression, calendars, CalendarIntervalTriggerImpl

The first official release that contains this fix is v2.1.0, which was tagged at revision 685.

The bug was located in CronExpression.GetTimeAfter() (which is called by CronExpression.GetNextValidTimeAfter()):

...
d = new DateTimeOffset(year, d.Month, d.Day, d.Hour, d.Minute, d.Second, d.Offset);

// apply the proper offset for this date (this wasn't there)
d = new DateTimeOffset(d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second, this.TimeZone.GetUtcOffset(d.DateTime));
...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!