Day ago count is wrong in issue comments #788

Closed
opened 2025-11-02 03:36:48 -06:00 by GiteaMirror · 11 comments
Owner

Originally created by @gayprogrammer on GitHub (Jun 7, 2017).

Today is Wednesday June 7 (19:21:25 UTC). The test issue in the above linked issue was created on Monday June 5 and was closed on Tuesday June 6. Here is what is displayed:

razzintown commented 1 day ago (Mon, 05 Jun 2017 23:52:30 UTC)
gitpitch closed 1 day ago (Tue, 06 Jun 2017 03:26:36 UTC)

Since 7 - 5 = 2 It should read 2 days ago for the number of days ago it was created.

I also suggest that 1 day ago should actually read yesterday.

Originally created by @gayprogrammer on GitHub (Jun 7, 2017). - Gitea version (or commit ref): 1.1.1+2-g2854c8a - Git version: 2.12.2 - Operating system: Windows Server 2012 - Database (use `[x]`): - [x] MSSQL - Can you reproduce the bug at https://try.gitea.io: - [x] Yes: https://try.gitea.io/gitpitch/code-presenting/issues/1 - Log gist: Not relevant Today is `Wednesday June 7 (19:21:25 UTC)`. The test issue in the above linked issue was created on `Monday June 5` and was closed on `Tuesday June 6`. Here is what is displayed: ``` razzintown commented 1 day ago (Mon, 05 Jun 2017 23:52:30 UTC) gitpitch closed 1 day ago (Tue, 06 Jun 2017 03:26:36 UTC) ``` Since `7 - 5 = 2` It should read `2 days ago` for the number of days ago it was created. I also suggest that `1 day ago` should actually read `yesterday`.
GiteaMirror added the type/enhancementissue/stale labels 2025-11-02 03:36:48 -06:00
Author
Owner

@sondr3 commented on GitHub (Jun 7, 2017):

You could also use a JS library to automatically and dynamically change the time, e.g. timeago.js. The aforementioned library also includes translations if that's something.

This is just throwing it out there, I see that you do this when pages are requested in Gitea. GitHub uses JS as well to automatically change datetime elements to their correct date. I also disagree with 1 day ago becoming yesterday, I'd much rather it becomes a day ago instead.

@sondr3 commented on GitHub (Jun 7, 2017): You could also use a JS library to automatically and dynamically change the time, e.g. [timeago.js](https://github.com/hustcc/timeago.js). The aforementioned library also includes translations if that's something. This is just throwing it out there, I see that you do this when pages are requested in Gitea. GitHub uses JS as well to automatically change `datetime` elements to their correct date. I also disagree with `1 day ago` becoming `yesterday`, I'd much rather it becomes `a day ago` instead.
Author
Owner

@gayprogrammer commented on GitHub (Jun 8, 2017):

Note that at this moment, the test issue linked above is showing the days ago correctly. There may be only a short span of time where this bug shows itself, or a certain time of day.
UPDATE: Yes, the bug in the test issue linked above appears every day.

@sondr3 I agree that using a JS library might be a better solution than having it done on the server. I am also perfectly fine with the phrase a day ago.

@gayprogrammer commented on GitHub (Jun 8, 2017): Note that at this moment, the test issue linked above is showing the days ago correctly. There may be only a short span of time where this bug shows itself, or a certain time of day. UPDATE: Yes, the bug in the test issue linked above appears every day. @sondr3 I agree that using a JS library might be a better solution than having it done on the server. I am also perfectly fine with the phrase `a day ago`.
Author
Owner

@lunny commented on GitHub (Jun 8, 2017):

yesterday means we need a new translation item. :)

@lunny commented on GitHub (Jun 8, 2017): `yesterday` means we need a new translation item. :)
Author
Owner

@gayprogrammer commented on GitHub (Jun 8, 2017):

@lunny This is a bug. (See https://try.gitea.io/gitpitch/code-presenting/issues/1)

razzintown commented 1 day ago (Mon, 05 Jun 2017 23:52:30 UTC)
gitpitch closed 1 day ago (Tue, 06 Jun 2017 03:26:36 UTC)

Monday and Tuesday are not both 1 day ago .

@gayprogrammer commented on GitHub (Jun 8, 2017): @lunny This is a bug. (See https://try.gitea.io/gitpitch/code-presenting/issues/1) ```` razzintown commented 1 day ago (Mon, 05 Jun 2017 23:52:30 UTC) gitpitch closed 1 day ago (Tue, 06 Jun 2017 03:26:36 UTC) ```` Monday and Tuesday are not both `1 day ago `.
Author
Owner

@bkcsoft commented on GitHub (Jun 11, 2017):

No it's not a bug...

now       (07 Jun 2017 19:21:25 UTC)
1 day ago (05 Jun 2017 23:52:30 UTC)
1 day ago (06 Jun 2017 03:26:36 UTC)

6th 03:26 => 7th 19:21 == 1 day, 15h 55m
5th 23:52 => 7th 19:21 == 1 day, 19h 29m

So 1 day is technically more correct than 2 days :)

@bkcsoft commented on GitHub (Jun 11, 2017): No it's not a bug... ``` now (07 Jun 2017 19:21:25 UTC) 1 day ago (05 Jun 2017 23:52:30 UTC) 1 day ago (06 Jun 2017 03:26:36 UTC) ``` 6th 03:26 => 7th 19:21 == 1 day, 15h 55m 5th 23:52 => 7th 19:21 == 1 day, 19h 29m So `1 day` is technically more correct than `2 days` :)
Author
Owner

@bkcsoft commented on GitHub (Jun 11, 2017):

It would however be an enhancement. But it would be very hard to do correctly... Don't want 5 minutes to show up as "1 day" (5th 23:58 => 6th 00:03)

@bkcsoft commented on GitHub (Jun 11, 2017): It would however be an enhancement. But it would be very hard to do correctly... Don't want 5 minutes to show up as "1 day" (`5th 23:58 => 6th 00:03`)
Author
Owner

@leitzler commented on GitHub (Jun 11, 2017):

Wouldn't it be good start with:
< 1 minute gives "x seconds ago"
< 1 hour gives "x minutes ago"
< 24 hours "x hours ago"
And leave the rest as is, or change them to calculate number of midnights passed in browser timezone.

@leitzler commented on GitHub (Jun 11, 2017): Wouldn't it be good start with: < 1 minute gives "x seconds ago" < 1 hour gives "x minutes ago" < 24 hours "x hours ago" And leave the rest as is, or change them to calculate number of midnights passed in browser timezone.
Author
Owner

@sondr3 commented on GitHub (Jun 12, 2017):

Which is more or less what the JS libraries do.

@sondr3 commented on GitHub (Jun 12, 2017): Which is more or less what the JS libraries do.
Author
Owner

@bkcsoft commented on GitHub (Jun 15, 2017):

I agree that we should use an existing JS-lib for this. Just keep the license in mind 😉

@bkcsoft commented on GitHub (Jun 15, 2017): I agree that we should use an existing JS-lib for this. Just keep the license in mind 😉
Author
Owner

@stale[bot] commented on GitHub (Feb 14, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Feb 14, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Feb 28, 2019):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Feb 28, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#788