Proposal: Have an api to retrieve the relativedelta information

オープン
#1,035 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@AdrianAtZyte がすでに取り組んでいます。

2026年9月25日 から。

  • #1447 @AdrianAtZyte による — オープン

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python
領域
backend

調査の方向性

既存の get_date_data API と、それが使用する parser のパスから始めてください。この issue では実装ファイルもテストも特定されていません。要求された構造化された結果を dateutil.relativedelta と比較し、「3 years and 6 months」のような式で元の単位をどのように保持するかを定義してから、その動作のテストカバレッジを追加してください。

索引モデルが issue の本文から書いたものです。

説明

dateparser is a fantastic tool to calculate a date given a literal expression like "3 years and 6 months".

However, it does not seem possible to leverage the syntactic parser to retrieve a relativedelta (https://dateutil.readthedocs.io/en/stable/relativedelta.html) structure filled with the result of the parsing.
For example if the text says:

3 years and 6 months

It would be great to obtain a structured filled with

relativedelta(year=3, month=6)

At least I could not find on the API a way to do so. The only way seems to calculate the resulting date with

dateparser.get_date_data("3 years 6 months")

then get the current date (datetime.now()) and derive the number of months. The drawback is you loose the resolution. In the example above, you will be able to calculate 42 months but won't be able to keep the original sentence meaning: 3 years and 6 months.

主要言語
Python
スター
2.9k
フォーク
545
平均マージ
2日 4時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

scrapinghub/dateparser のほかの issue

scrapinghub/dateparser の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。