scrapinghub / scrapinghub/dateparser

changing range of month

Open
#1,209 0 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 want to search for dates in phrases but in Persian language which use Jalali calendar.
Because Jalali calendar does not work for searching longer chunks of texts, I changed the translation data in this format:
I changed the months name in gregorian calendar without changing the calendar from gregorian to Jalali.
I also change the relative_base date to the current time in Jalali calendar (again without changing the calendar from gregorian to Jalali).

Everything works well except that in Jalali calendar length of month differ from those on Gregorian calendar. For example February has 28,29 days in Gregorian but 'اردیبهشت' which is equal to Feb has 31 days in Jalali calendar.
How can I fix that?
Precisely, I want to change length of month in gregorian calendar in this format:
first 6 months (Jan to Jun): has 31 days
next 5 months (Jul to Nov): 30 days
Dec: 29 days

very kind regards for any help

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 reviewing dateparser's translation-data and relative_base handling, then reproduce the Persian/Jalali example described in the issue. Determine where month lengths are defined and verify that the requested 31/30/29-day pattern is applied consistently; the issue is done when searches using those Persian month names handle the requested ranges correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
internationalization, localization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.