Fix #2652 by using local timestamps

Because users write their queries in local time, we want to get a local time
tuple from the timestamp stored in the database.
This commit is contained in:
Adrian Sampson 2018-02-20 23:22:31 -05:00
parent 492ff7359a
commit 502536f4b6
2 changed files with 6 additions and 1 deletions

View file

@ -708,7 +708,7 @@ class DateQuery(FieldQuery):
if self.field not in item:
return False
timestamp = float(item[self.field])
date = datetime.utcfromtimestamp(timestamp)
date = datetime.fromtimestamp(timestamp)
return self.interval.contains(date)
_clause_tmpl = "{0} {1} ?"

View file

@ -46,6 +46,11 @@ Fixes:
* Avoid a crash when importing a non-ASCII filename when using an ASCII locale
on Unix under Python 3.
:bug:`2793` :bug:`2803`
* Fix a problem caused by time zone misalignment that could make date queries
fail to match certain dates that are near the edges of a range. For example,
querying for dates within a certain month would fail to match dates within
hours of the end of that month.
:bug:`2652`
1.4.6 (December 21, 2017)