Skip to content

Commit 8b8065b

Browse files
committed
fix: allow 'N {interval} from now' (#502)
1 parent e9324ee commit 8b8065b

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

dateparser/data/date_translation_data/en.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@
747747
"and",
748748
"at",
749749
"by",
750+
"from",
750751
"just",
751752
"m",
752753
"nd",

dateparser_data/supplementary_language_data/date_translation_data/en.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
skip: ["about", "ad", "and", "at", "by", "just", "m", "nd", "of", "on", "rd", "st", "th", "the"]
1+
skip: ["about", "ad", "and", "at", "by", "from", "just", "m", "nd", "of", "on", "rd", "st", "th", "the"]
22
pertain: ["of"]
33

44
sentence_splitter_group : 1

tests/test_freshness_date_parser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ def test_relative_past_dates_with_time_as_period(self, date_string, ago, period)
122122
period="day",
123123
),
124124
param("just now", ago={"seconds": 0}, period="day"),
125+
param('11 hours from now', in_future={'hours': 11}, period='hour'),
126+
param('10 days from now', in_future={'days': 10}, period='day'),
127+
param('9 weeks from now', in_future={'weeks': 9}, period='week'),
128+
param('8 months from now', in_future={'months': 8}, period='month'),
129+
param('7 years from now', in_future={'years': 7}, period='year'),
125130
# Fix for #291, work till one to twelve only
126131
param("nine hours ago", ago={"hours": 9}, period="day"),
127132
param("three week ago", ago={"weeks": 3}, period="week"),

0 commit comments

Comments
 (0)