Skip to content

grab_next_visits: avoid time interval calculations in PostgreSQL

When the database is in a non-UTC timezone with DST, and a `timestamptz

  • interval` calculation crosses a DST change, the result of the calculation can be one hour off from the expected value:

PostgreSQL will vary the timestamp by the amount of days in the interval, and will keep the same (local) time, which will be offset by an hour because of the DST change.

Doing the datetime +- timedelta calculations in Python instead of PostgreSQL avoids this caveat altogether.

Test Plan

tox passes when the database is in Europe/Paris timezone


Migrated from D6563 (view on Phabricator)

Merge request reports