scrapinghub / scrapinghub/dateparser

How to parse when month or day is missing?

Open
#424 3 comments 4 reactions 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

The following only says the year is 2017. But dateparser will fill in the month and day as the today. I don't think that this is the most appropriate behavior.

>>> from dateparser import parse
>>> print(parse('2017'))
2017-06-18 00:00:00

Is there a way to just print the most specific information like the following?

  • '2017' -> '2017'
  • '2017 Jan' -> '2017-01'

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 documented dateparser.parse('2017') and parse('2017 Jan') examples, then trace how missing month and day values are filled. Done means the parser can preserve the input's most specific date precision, with behavior for year-only and year-month inputs covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.