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

Fix short weekday names #1214

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

adnan-awan
Copy link
Contributor

@adnan-awan adnan-awan commented Jan 28, 2024

Fixes #1170

@wRAR
Copy link
Member

wRAR commented Jan 29, 2024

Please check https://github.com/scrapinghub/dateparser/blob/master/CONTRIBUTING.rst#guidelines-for-editing-translation-data about editing language data (you edited a generated file).

- Update en.yaml file to support two letters days of the week
- #1170
@adnan-awan adnan-awan reopened this Jan 30, 2024
@Gallaecio
Copy link
Member

Any idea about the failing test?

- Develop method to remove_multiple_occurrences of the day(s) of the week
- #1170
Comment on lines +125 to +135
def remove_multiple_occurrences(self, date_str_tokens: list):
# first occurrence of day of the week will be considered
# followings occurrence(s) will be skipped and removed from the token list.
weekdays_counter = 0
for i, token in enumerate(date_str_tokens):
if token in self.weekdays:
weekdays_counter += 1

if weekdays_counter > 1:
date_str_tokens.pop(i)
continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting solution. I imagine it is not perfect, but if current tests pass, onward! We can always iterate on it later.

@Gallaecio
Copy link
Member

Could you add tests for the fix itself? (7 dates with the short weekday form that are properly parsed) I think that’s all that’s left.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parsing very short weekday names
3 participants