scrapinghub / scrapinghub/dateparser

RELATIVE_BASE supersedes PREFER_MONTH_OF_YEAR

Open
#1,226 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

MCVE:


In [1]: from datetime import datetime

In [2]: import dateparser

In [3]: settings={'PREFER_DAY_OF_MONTH': 'first', 'PREFER_MONTH_OF_YEAR': 'first', 'RELATIVE_BASE': datetime(2023, 8, 23)}

In [4]: dateparser.parse("2022", settings=settings).date()
Out[4]: datetime.date(2022, 8, 1)

In [5]: dateparser.__version__
Out[5]: '1.2.0'

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 running the MCVE against dateparser 1.2.0 and trace how the settings dictionary is applied during parsing. Inspect the code paths handling RELATIVE_BASE, PREFER_MONTH_OF_YEAR, and PREFER_DAY_OF_MONTH; done means the precedence described by the issue is resolved and the reproduced result reflects the intended settings.

Written by the indexing model from the issue text.

Assessment

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