postgresql: Fix one-by-one error in db_to_date on negative dates
Using int()
on date.timestamp()
rounded it up (toward zero),
but the semantics of model.Timestamp
is that the actual time is
ts.seconds + ts.microseconds/1000000
, so all negative dates were
shifted one second up.
In particular, this causes dates from
1969-12-31T23:59:59.000001
to 1969-12-31T23:59:59.999999
(inclusive) to smash into dates from
1970-01-01T00:00:00.000001
to 1970-01-01T00:00:00.999999
,
which is how I discovered the issue.
Depends on !749 (closed).
Migrated from D6815 (view on Phabricator)