scrapinghub / scrapinghub/dateparser

rounding up and down

Open
#919 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi, I am working on a program where the user can select some files using newer-than and older-than predicates as for instance:

foo --older-than=yesterday --newer-than="5 days ago"

The issue I have is that dataparser uses the current time when that part is missing. So, for instance, that --older-than=yesterday above, becomes something like 2021-05-02 14:42:36.990992, but what I need is 2021-05-02 00:00:00.

On the other hand, I would like --newer-than=yesterday to become 2021-05-02 23:59:59.99999. And in a similar fashion, I would like --newer-than=2020 to become 2020-12-31 23:59:59.99999.

The idea is very similar to that of PREFER_DAY_OF_MONTH but for all the parts, not just months.

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 --older-than and --newer-than examples from the issue and trace how dateparser fills missing components. Confirm the intended boundaries for days and years, then add coverage showing that each predicate resolves to the requested start or end of the period.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.