scrapinghub / scrapinghub/dateparser

Chinese date is parsed into year 1

Open
#866 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The following straightforward string parses incorrectly

>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 7, 58, 587351)

Furthermore, the result is not consistent

>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 11, 140651)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 11, 925638)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 12, 500666)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 12, 930812)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 13, 385392)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 13, 730447)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 14, 705554)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 15, 165488)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 15, 575601)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 15, 930604)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 22, 46657)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 22, 705704)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 23, 805362)
>>> dateparser.parse('2019 年 10 月 30 日')
datetime.datetime(1, 2, 8, 22, 12, 24, 250476)

Expected result: datetime.datetime(2019, 10, 30, 0, 0)

Hypothesis: this string is parsed internally as "2019 years 10 months 30 days ago", where ago is the incorrect part.

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 issue through dateparser.parse with the Chinese date string shown. Trace why it is interpreted as time ago rather than a calendar date, and verify that repeated parses consistently return datetime.datetime(2019, 10, 30, 0, 0).

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
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.