From c6ff971246c82420627b694943d79891136bddde Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Sun, 14 Jan 2018 14:53:56 +0330 Subject: [PATCH] fix: add yesterday as special case --- humandate/index.py | 2 +- humandate/tests.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/humandate/index.py b/humandate/index.py index 4ede3c3..7c25e4a 100644 --- a/humandate/index.py +++ b/humandate/index.py @@ -44,7 +44,7 @@ symbols = ['!', ',', '@', '#', '$', '%', '^', '&', '*', '?'] transformations = [dict(zip((x + 's' for x in multipliers.keys()), multipliers.keys()))] transformations.append(dict(zip(direction.keys(), (x + ' ' + '1' for x in direction.keys())))) -transformations.append({ 'tomorrow': 'next day' }) +transformations.append({ 'tomorrow': 'next day', 'yesterday': 'past 1 day' }) transformations.append({ 'next': '1', 'upcoming': '1', 'following': '1', 'a': '1', 'an': '1' }) keywords = list(multipliers.keys()) + months + months_short + years + days + days_short + list(direction.keys()) + [time_prefix] + time_postfix diff --git a/humandate/tests.py b/humandate/tests.py index b1bb75a..d60105a 100644 --- a/humandate/tests.py +++ b/humandate/tests.py @@ -99,6 +99,7 @@ class HumanDateTests(unittest.TestCase): 'a week ago': self.today - timedelta(days=7), 'a month ago': self.today - timedelta(days=30), 'a year past': self.today - timedelta(days=365), + 'yesterday': self.today - timedelta(days=1), } for (k, date) in tests.items():