Skip to content

Commit

Permalink
Issue/912 rel dates err ind (#1094)
Browse files Browse the repository at this point in the history
* resolved error in relative indonesian dates, now relative indonesian dates support full words for month and year as well

* added test for corresponding changes

* Update id yaml

Co-authored-by: atharmohammad <mohd.rule123@gmail.com>
  • Loading branch information
serhii73 and atharmohammad committed Nov 10, 2022
1 parent f71d5b8 commit 0b5b5af
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dateparser/data/date_translation_data/id.py
Expand Up @@ -193,7 +193,8 @@
],
"\\1 month ago": [
"(\\d+[.,]?\\d*) bln lalu",
"(\\d+[.,]?\\d*) bulan yang lalu"
"(\\d+[.,]?\\d*) bulan yang lalu",
"(\\d+[.,]?\\d*) bulan lalu"
],
"\\1 second ago": [
"(\\d+[.,]?\\d*) detik yang lalu",
Expand All @@ -205,7 +206,8 @@
],
"\\1 year ago": [
"(\\d+[.,]?\\d*) tahun yang lalu",
"(\\d+[.,]?\\d*) thn lalu"
"(\\d+[.,]?\\d*) thn lalu",
"(\\d+[.,]?\\d*) tahun lalu"
],
"in \\1 day": [
"dalam (\\d+[.,]?\\d*) h",
Expand Down
Expand Up @@ -28,3 +28,10 @@ relative-type:
- sehari
0 second ago:
- baru saja

relative-type-regex:
\1 month ago:
- (\d+[.,]?\d*) bulan lalu

\1 year ago:
- (\d+[.,]?\d*) tahun lalu
5 changes: 5 additions & 0 deletions tests/test_freshness_date_parser.py
Expand Up @@ -464,6 +464,11 @@ def test_relative_past_dates_with_time_as_period(self, date_string, ago, period)
param("před 12 lětom 15 měsac", ago={'years': 12, 'months': 15}, period='month'),
# hy
param("15 րոպե առաջ", ago={'minutes': 15}, period='day'),
# id
param("4 tahun lalu", ago={'years': 4}, period='year'),
param("4 thn lalu", ago={'years': 4}, period='year'),
param("4 bulan lalu", ago={'months': 4}, period='month'),
param("4 bln lalu", ago={'months': 4}, period='month'),
# is
param("fyrir 3 ári fyrir 2 mánuði", ago={'years': 3, 'months': 2}, period='month'),
# it
Expand Down

0 comments on commit 0b5b5af

Please sign in to comment.