scrapinghub / scrapinghub/dateparser

Strings with year abbreviation don't parse correctly

Open
#516 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi there

I just started evaluating this library for use in a service. I noticed a small bit of trivia that I've found with other datetime parsing libraries.

Passing in 1y does not parse correctly. I can understand, since there is no 1m to mean one month, but year should be a unique character, at least to the english language?

As of 04/09/19, it outputs 2019-04-01 00:00:00. I'm not 100% on what unit it's deciding on, but maybe someone else will have some insight.

What makes this more interesting is if I pass en in a list of languages, it just returns None. As a matter of fact, en doesn't work at all.... Hm. I'll figure out what I'm doing wrong there

Thanks!

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 reported 1y input and the language-list case using en, then trace the parser entry point that handles abbreviated units and language selection. Done means the intended year abbreviation behavior is defined and covered for both examples, with the existing parsing behavior verified by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
internationalization
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.