mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add #5332 - 'today' as a date search
This commit is contained in:
parent
feaebe3524
commit
f12c081bde
@ -13,7 +13,7 @@ from PyQt4.QtCore import QThread, QReadWriteLock
|
|||||||
from PyQt4.QtGui import QImage
|
from PyQt4.QtGui import QImage
|
||||||
|
|
||||||
from calibre.utils.config import tweaks, prefs
|
from calibre.utils.config import tweaks, prefs
|
||||||
from calibre.utils.date import parse_date
|
from calibre.utils.date import parse_date, now
|
||||||
from calibre.utils.search_query_parser import SearchQueryParser
|
from calibre.utils.search_query_parser import SearchQueryParser
|
||||||
from calibre.utils.pyparsing import ParseException
|
from calibre.utils.pyparsing import ParseException
|
||||||
|
|
||||||
@ -232,6 +232,11 @@ class ResultCache(SearchQueryParser):
|
|||||||
loc = self.FIELD_MAP[self.custom_column_label_map[location]['num']]
|
loc = self.FIELD_MAP[self.custom_column_label_map[location]['num']]
|
||||||
else:
|
else:
|
||||||
loc = self.FIELD_MAP[{'date':'timestamp', 'pubdate':'pubdate'}[location]]
|
loc = self.FIELD_MAP[{'date':'timestamp', 'pubdate':'pubdate'}[location]]
|
||||||
|
|
||||||
|
if query == _('today'):
|
||||||
|
qd = now()
|
||||||
|
field_count = 3
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
qd = parse_date(query)
|
qd = parse_date(query)
|
||||||
except:
|
except:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user