scrapinghub / scrapinghub/dateparser

Inconsistent behavior on shortened month name (portuguese and spanish)

Open
#1,231 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
520
Avg merge
22h 56m
Merged PRs (30d)
6

Description

The parse function behaves inconsistently when dealing with shortened dates in Portuguese:
image

The function works as expected until April, which is written Abril in PT, thus abr/18, and then it interprets the 18 as the day of the month. Changing abr to apr makes the function work. I have confirmed the same issue appears in spanish.
It's important to note that the function is indeed recognizing that abr is April, because it is returning a date in the correct month, but it for some reason ignores the specification that the "/18" is the year, not the day.

The bug was found on Windows 10, but I reproduced it now on Fedora 40, KDE spin, kernel version 6.8.11-300.fc40.x86_64. Python is 3.12.3 on a fresh install using rye.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the parse function with the shortened Portuguese and Spanish month forms described in the issue, especially abr/18. Inspect the parsing path for these locales and add or update coverage so the numeric suffix is treated as the year rather than the day, while preserving the correct April result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.