concourse / time-resource

a resource for triggering on an interval
Apache License 2.0
44 stars 33 forks source link

Fix checking whether previous time is in range #27

Closed jleben closed 6 years ago

jleben commented 6 years ago

The existing algorithm checks whether the day of the previous time is less than the day of the current time, when the two times are converted to UTC.

This is problematic in two ways:

This commit fixes the above problems.

This commit also adds new tests which verify that the problems described above are fixed.

Moreover, the tests are fixed by interpreting test times in the year 2018 instead of the year 0. Without this some tests would fail falsely, because they expect present time to be in the range when the range is interpreted at the given location in 2018, but that is not the case when it is interpreted at the given location in the year 0.

pivotal-issuemaster commented 6 years ago

@jleben Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-issuemaster commented 6 years ago

@jleben Thank you for signing the Contributor License Agreement!