From 0234f6188b6f10dad96e2ea8dc67d2674c26c02d Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 27 Jul 2020 15:54:30 -0700 Subject: search: tweak 'past week' date range to not include future --- fatcat_scholar/search.py | 6 ++++-- 1 file 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 -- cgit v1.2.3