Skip to content

Commit

Permalink
Fix #2652 by using local timestamps
Browse files Browse the repository at this point in the history
Because users write their queries in local time, we want to get a local time
tuple from the timestamp stored in the database.
  • Loading branch information
sampsyo committed Feb 21, 2018
1 parent 492ff73 commit 502536f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion beets/dbcore/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def match(self, item):
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} ?"
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 502536f

Please sign in to comment.