Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #864 #1005

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion dateparser/data/date_translation_data/en.py
Expand Up @@ -126,7 +126,8 @@
],
"relative-type": {
"0 day ago": [
"today"
"today",
"till date"
],
"0 hour ago": [
"this hour"
Expand Down
Expand Up @@ -47,6 +47,8 @@ relative-type:
- this decade
in 1 decade:
- next decade
0 day ago:
- till date

relative-type-regex:
in \1 decade:
Expand Down
3 changes: 3 additions & 0 deletions tests/test_freshness_date_parser.py
Expand Up @@ -67,6 +67,7 @@ def test_relative_past_dates_with_time_as_period(self, date_string, ago, period)
param('yesterday', ago={'days': 1}, period='day'),
param('the day before yesterday', ago={'days': 2}, period='day'),
param('today', ago={'days': 0}, period='day'),
param('till date', ago={'days': 0}, period='day'),
param('an hour ago', ago={'hours': 1}, period='day'),
param('about an hour ago', ago={'hours': 1}, period='day'),
param('a day ago', ago={'days': 1}, period='day'),
Expand Down Expand Up @@ -586,6 +587,7 @@ def test_relative_past_dates(self, date_string, ago, period):
param('yesterday', ago={'days': 1}, period='day'),
param('the day before yesterday', ago={'days': 2}, period='day'),
param('today', ago={'days': 0}, period='day'),
param('till date', ago={'days': 0}, period='day'),
param('an hour ago', ago={'hours': 1}, period='day'),
param('about an hour ago', ago={'hours': 1}, period='day'),
param('a day ago', ago={'days': 1}, period='day'),
Expand Down Expand Up @@ -1073,6 +1075,7 @@ def test_normalized_relative_dates(self, date_string, ago, period):
param('in a decade', in_future={'years': 10}, period='year'),
param('tomorrow', in_future={'days': 1}, period='day'),
param('today', in_future={'days': 0}, period='day'),
param('till date', in_future={'days': 0}, period='day'),
param('in an hour', in_future={'hours': 1}, period='day'),
param('in about an hour', in_future={'hours': 1}, period='day'),
param('in 1 day', in_future={'days': 1}, period='day'),
Expand Down
4 changes: 3 additions & 1 deletion tests/test_search.py
Expand Up @@ -302,7 +302,9 @@ def test_search_date_string(self, shortname, datetime_string):
[('25th march 2015', datetime.datetime(2015, 3, 25)),
('today', datetime.datetime(2000, 1, 1))],
settings={'RELATIVE_BASE': datetime.datetime(2000, 1, 1)}),

param('en', 'The employee has not submitted their documents till date',
[('till date', datetime.datetime(2000, 1, 1))],
settings={'RELATIVE_BASE': datetime.datetime(2000, 1, 1)}),
# Filipino / Tagalog
param('tl', 'Maraming namatay sa mga Hapon hanggang sila\'y sumuko noong Agosto 15, 1945.',
[('noong Agosto 15, 1945', datetime.datetime(1945, 8, 15, 0, 0))],
Expand Down