`Timex.from_now` unexpected result

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

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
elixir
領域
backend

調査の方向性

まず、報告されている Timex 3.7.8 の再現手順を実行し、Timex.from_now のエントリポイントを追跡します。返される文言を、issue で期待されている暦日としての解釈と比較し、その後、両方の例に対するリグレッションテストを追加します。例が合意された結果を生成し、動作がテストによって文書化されれば完了です。

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

説明

Steps to reproduce

timex 3.7.8

{:ok, dt, 0} = DateTime.from_iso8601("2022-07-30 17:06:27Z")
{DateTime.utc_now(), Timex.from_now(dt)}
# {~U[2022-08-01 08:20:03.093411Z], "yesterday"}

{:ok, dt, 0} = DateTime.from_iso8601("2022-07-29 17:17:39Z")
{DateTime.utc_now(), Timex.from_now(dt)}
# {~U[2022-08-01 08:21:43.460553Z], "2 days ago"}
Description of issue
  • What are the expected results?
    All of those results seem to be off by 1 day by my understanding.

Yesterday is the day before today, which from the perspective of 2022-08-01 is 2022-07-31, not 2022-07-30. Also in the same context I'd consider 2022-07-29 to be 3 days ago, though that one feels a bit more open to interpretation.

  • If you are certain this is a bug in Timex, do you have references I
    can use to check the algorithm/logic against? For instance, a well-established
    date/time library in another language, a paper, test suite, etc. It is by no
    means a requirement, but is immensely helpful in fixing bugs, and provides me
    extra data to use when building out the test suite
主要言語
Elixir
スター
1.8k
フォーク
408
平均マージ
2時間 8分
マージ済み PR(30日)
1

環境構築

はじめの一歩

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

bitwalker/timex のほかの issue

bitwalker/timex の issue をすべて見る

似ている issue

Elixir の issue をもっと見る

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

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