github / github/relative-time-element

Inconsistent use of "yesterday"

オープン
#313 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
4k
フォーク
192
平均マージ
1日 10時間
マージ済み PR(30日)
5

説明

Using relative-time-element v4.4.5.

I am in a UTC-5 time zone. The current time for me is April 30 1:53PM (2025-04-30 18:53 UTC).

I've set up a test page at https://greasyfork.org/en/relative_date_test to show the last 48 hours of ``. Here is what I see:

![Image](https://github.com/user-attachments/assets/63a20139-aaff-45a6-84f6-34e088372a67)

- 0 hours ago shows "now", no issue.
- 1 - 13 hours ago (Apr 30 for me) - shows as "x hours ago", no issue.
- 14 - 20 hours ago (Apr 29 for me) - shows as "x hours ago", could also show as "yesterday", but that's fine.
- 21 - 35 hours ago (Apr 29 for me) - shows as "yesterday", no issue.
- **36 - 37 hours ago (Apr 29 for me) - shows as "2 days ago".**
- 38 - 48 hours ago (Apr 28 for me) - shows as "2 days ago", no issue.

36 and 37 hours ago for me is Apr 29 12:53AM and 1:53AM, which is still "yesterday", not "2 days ago". Especially weird that then Apr 29 2:53AM _is_ "yesterday".

I imagine that maybe "1.5 days ago" is getting rounded up to "2 days ago", but "yesterday" is a concept of calendar dates and not a number of hours, so there's no reason to stop using that term until it's no longer 1 calendar day ago.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with the linked relative_date_test page and reproduce the reported behavior using relative-time-element v4.4.5 in the UTC-5 example. Trace the relative-time rendering entry point and verify that timestamps 36–37 hours old still display “yesterday” when they fall on the previous local calendar date, while timestamps from two calendar dates ago display “2 days ago”.

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

評価

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

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

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