scrapinghub / dateparser

python parser for human readable dates
BSD 3-Clause "New" or "Revised" License
2.55k stars 465 forks source link

Add support for date range #522

Open igo opened 5 years ago

igo commented 5 years ago

Would be great to support recognition of date ranges like '12th - 13th April 2019', 'April 12-13', ...

Gallaecio commented 5 years ago

@igo I believe this is a duplicate of #262. Could you close this issue and vote up #262 instead? This comment of mine already links your issue to #262, so hopefully, when support is implemented, your suggested examples of date range strings will be taken into consideration.

christosvar commented 5 years ago

I think this would be very useful.

What I would expect as output from search_dates would be like: '12th - 13th April 2019' -> [('12th', datetime.datetime(2019, 4, 12, 0, 0)), ('13th April 2019', datetime.datetime(2018, 4, 13, 0, 0))] 'Aug - Sept 2018' -> [('Aug', datetime.datetime(2019, 8, 4, 0, 0)), ('Sept 2018', datetime.datetime(2018, 9, 4, 0, 0))]

I think that this is different than #262 . What is needed here is to change the RELATIVE_BASE of the first date ('12th') to be equal to the full date object found in the input string ('13th April 2019').