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 time ranges #938

Open walking-octopus opened 3 years ago

walking-octopus commented 3 years ago

Why?

A lot of use cases for date parsing may include the need to understand date ranges. Natural language search by date may need to parse input as a time span. Like interpreting "yesterday" as 2021.6.21 00:01 to 2021.6.21 23:60, instead of 2021.6.21 18:40.

Examples

Implementation

Maybe it can be a parser setting. It can be implemented something like this: parse('yesterday', settings={'DATE_RANGE': True}).

Gallaecio commented 3 years ago

Related to https://github.com/scrapinghub/dateparser/issues/262