occurs_on? misses when time is near midnight #245

merged 1 commit into from Jul 6, 2014


None yet
1 participant

avit commented Jul 6, 2014

occurs_on? incorrectly reports false when:

  • Using Time.local as the schedule start time
  • The schedule start time is near midnight
  • The queried date is at the opposite end of the year

It looks like DST is not being applied correctly for the date boundaries.

Fix DST offset for `occurs_on` using local times
When building a new time for `beginning_of_date` / `end_of_date` we now
use `Time.local` or `Time.utc` correctly to apply the right offset for
the time of year (in absence of ActiveSupport). Previously, only a
"non-local" time with a fixed offset was was applied so a reference time
6 months from the target date could have the wrong DST offset applied.

This now matches the same order of zone lookup used in `match_zone`.
The fallback is to use the fixed offset only when no correct zone
information is available.

avit added a commit that referenced this pull request Jul 6, 2014

Merge pull request #245 from avit/issues/245
Fix `occurs_on?` misses when time is near midnight

@avit avit merged commit a79d498 into seejohnrun:master Jul 6, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed

@avit avit deleted the avit:issues/245 branch Jul 6, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment