Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dateparser/data/date_translation_data/en.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,9 @@
{
"from\\s+now": "in"
},
{
"(\\d+(?:st|nd|rd|th)?) of the month": "\\1 of this month"
},
{
"less than 1 minute ago": "45 second ago"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ simplifications:
- in the ((?:early )?morning|afternoon|evening|night|small hours|wee hours): \1
- (\d+[.,]?\d*)h(\d+[.,]?\d*): \1:\2
- from\s+now: in
- (\d+(?:st|nd|rd|th)?) of the month: \1 of this month
- less than 1 minute ago: 45 second ago
- (\d+(?:st|nd|rd|th)) day: \1
- (\d+[.,]?\d*|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve) (decade|year|month|week|day|hour|minute|second)s? later: in \1 \2
Expand Down
2 changes: 2 additions & 0 deletions tests/test_freshness_date_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2367,6 +2367,7 @@ def test_relative_future_dates(
[
param("15th of Aug, 2014 Diane Bennett"),
param("4 heures ago"),
param("the 31st of the month"),
param("the 31st of this month"),
param("the 1st of last month 2 days ago"),
]
Expand Down Expand Up @@ -2607,6 +2608,7 @@ def test_freshness_date_with_timezone_utc_offset(
param("in 1.5 days", date(2010, 6, 6), time(1, 15)),
param("0,5 hours ago", date(2010, 6, 4), time(12, 45)),
# Day of a relative month
param("the 1st of the month", date(2010, 6, 1), time(13, 15)),
param("the 1st of last month", date(2010, 5, 1), time(13, 15)),
param("the 1st of this month", date(2010, 6, 1), time(13, 15)),
param("30th of next month at 5pm", date(2010, 7, 30), time(17, 0)),
Expand Down
12 changes: 12 additions & 0 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,18 @@ def test_detection(self, shortname: str, text: str) -> None:
],
),
param(text="a Americ", languages=None, settings=None, expected=None),
param(
text="Photo of the month, 12 March 1999",
languages=["en"],
settings=None,
expected=[("12 March 1999", datetime.datetime(1999, 3, 12, 0, 0))],
),
param(
text="Employee of the month",
languages=["en"],
settings=None,
expected=None,
),
# Date with comma and apostrophe
param(
text="9/3/2017 , ",
Expand Down
Loading