scrapinghub / scrapinghub/dateparser

Get date format that matched the date string

Open
#341 2 comments 6 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

Is it possible to get back the date format that was matches and used for parsing?

If not, then I guess that would be a feature request.

so
dateparser.guessFormat('20170705') = '%Y%m%d'

a little bit more complex version can get an array of date strings as an argument and return a date format only if all the dates in array match the format. That will help to avoid situation when certain date strings can not be identified uniquely like 01-03-2017 may be Jan 03, or Mar 01.

The original use case is to help user with the format definition. So application get file as input, analyze data in the file with some sampling and try to create a nice parser for the given file. User input is required to some extent, but the desire is to minimize the hassle from the user side.

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

The proposed entry point is dateparser.guessFormat, with a single date string or an array of date strings as input. Start by reviewing the existing parsing and format-detection behavior; done means returning the format used for an unambiguous string and handling arrays only when all values match consistently.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.