summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/search.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-07-27 15:54:30 -0700
committerBryan Newbold <bnewbold@archive.org>2020-07-27 15:54:30 -0700
commit0234f6188b6f10dad96e2ea8dc67d2674c26c02d (patch)
tree68eca1cffaa4dca0eebc4d8f0d8ad9607a0f39f4 /fatcat_scholar/search.py
parent0c7a2ace5d7c5b357dd4afa708a07e3fa85849fd (diff)
downloadfatcat-scholar-0234f6188b6f10dad96e2ea8dc67d2674c26c02d.tar.gz
fatcat-scholar-0234f6188b6f10dad96e2ea8dc67d2674c26c02d.zip
search: tweak 'past week' date range to not include future
Diffstat (limited to 'fatcat_scholar/search.py')
-rw-r--r--fatcat_scholar/search.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py
index 7725f46..3781700 100644
--- a/fatcat_scholar/search.py
+++ b/fatcat_scholar/search.py
@@ -119,8 +119,10 @@ def do_fulltext_search(
# time filters
if query.filter_time == "past_week":
- week_ago_date = str(datetime.date.today() - datetime.timedelta(days=7))
- search = search.filter("range", date=dict(gte=week_ago_date))
+ date_today = datetime.date.today()
+ week_ago_date = str(date_today - datetime.timedelta(days=7))
+ tomorrow_date = str(date_today + datetime.timedelta(days=1))
+ search = search.filter("range", date=dict(gte=week_ago_date, lte=tomorrow_date))
elif query.filter_time == "past_year":
# (date in the past year) or (year is this year)
# the later to catch papers which don't have release_date defined