scrapinghub / scrapinghub/dateparser

Specify which elements are to be expected in which order for incomplete dates

Open
#543 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In my work I am facing dates that can have different shapes. The dates are meant to specify a certain period, which can be more or less specific. The date always contains a year. After that it might contain a month. If we're really lucky, it also contains a day.

Some examples:

  • 28 (which means ??/??/2028)
  • 11/28 (which means ??/11/2028)
  • November-2028 (which means ??/11/2028)
  • 2028 (which means ??/??/2028)
  • 15/11/28 (which means 15/11/2028)

I guess you get it.

Hours and minutes are not relevant to me, but I guess it could be implemented in the same pull request.

I expect a setting to be shaped as follows:
settings={'ELEMENT_EXPECTATION_ORDER':'YMDhms'}

(not sure about the hour, minute, second signage)

The parser will follow this order to find the elements. Thus beginning with the year,
If the parser encounters an element that is possibly a month or a year, it will check the order and choose to name it was a year accordingly. Then it will proceed with the next in line.

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

No file, test, or entry point is named in the issue. Start by locating the date parser and settings handling, then determine how incomplete dates and ambiguous numeric elements are currently processed. Done means the requested element-order setting and the listed year/month/day examples have defined, tested behavior, including the unresolved time-element notation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
localization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.