Add global setting how timestamps should be rendered#28657
Add global setting how timestamps should be rendered#28657lunny merged 7 commits intogo-gitea:mainfrom
Conversation
Some admins prefer all timestamps to display the full date instead of relative time. They can do that now by setting ```ini [ui] PREFER_ABSOLUTE_TIMESTAMPS = true ``` Signed-off-by: Yarden Shoham <git@yardenshoham.com>
custom/conf/app.example.ini
Outdated
| ;EXPLORE_PAGING_DEFAULT_SORT = recentupdate | ||
| ;; | ||
| ;; Whether to prefer all timestamps to be rendered as absolute. Setting this to false means some timestamps would render as relative. | ||
| ;PREFER_ABSOLUTE_TIMESTAMPS = false |
There was a problem hiding this comment.
On a related note, wouldn't it be better to name the setting
| ;PREFER_ABSOLUTE_TIMESTAMPS = false | |
| ;TIMESTAMP_FORMAT = relative |
with relative,absolute being the possible options (for now)
There was a problem hiding this comment.
I don't think other options exist
There was a problem hiding this comment.
I can think of a few at the top of my head: relative_v2, relative_legacy, absolute_v2, absolute_legacy, both, …
There was a problem hiding this comment.
If relative is set here, some timestamps still render as absolute though (e.g. joined on date in profile page)
There was a problem hiding this comment.
Yeah, but those are either intended or a bug.
Either way, to me it makes sense despite some minor exceptions.
There was a problem hiding this comment.
Okay, if you add a comment why relative does not yet exist.
There was a problem hiding this comment.
My current description is:
PREFERRED_TIMESTAMP_TENSE: mixed: The tense all timestamps should be rendered as. Possible values areabsolutetime (i.e. 1970-01-01, 11:59) ormixedwhich means some timestamps would render as relative (i.e. 2 days ago).
There was a problem hiding this comment.
Today some of our timestamps are absolute and some are relative. I don't know why.
Co-authored-by: delvh <dev.lh@web.de> Signed-off-by: Yarden Shoham <git@yardenshoham.com>
|
Should we make this also a user setting? |
|
Tried it in #24342 |
|
See #24342, but yes, this is probably the next step. |
The user setting system has some framework-level problems: too complex to use, and it might cause bugs easily. I have refactored the system setting package in #27000 , IMO the user setting system also needs some big refactoring. |
Signed-off-by: Yarden Shoham <git@yardenshoham.com>
…estamps Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: delvh <dev.lh@web.de>
* giteaofficial/main: Add global setting how timestamps should be rendered (go-gitea#28657) [skip ci] Updated translations via Crowdin Upgrade xorm to new version which supported update join for all supported databases (go-gitea#28590) Fix: system webhooks API bug (go-gitea#28531) Fix alpine package files are not rebuilt (go-gitea#28638) Fix migration test (go-gitea#28659) Avoid cycle-redirecting user/login page (go-gitea#28636) Fix long package version names overflowing (go-gitea#28619)
- Resolves go-gitea#22493 - Related to go-gitea#4520 Some admins prefer all timestamps to display the full date instead of relative time. They can do that now by setting ```ini [ui] PREFERRED_TIMESTAMP_TENSE = absolute ``` This setting is set to `mixed` by default, allowing dates to render as "5 hours ago". Here are some screenshots of the UI with this setting set to `absolute`:    --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: delvh <dev.lh@web.de>
- Resolves go-gitea#22493 - Related to go-gitea#4520 Some admins prefer all timestamps to display the full date instead of relative time. They can do that now by setting ```ini [ui] PREFERRED_TIMESTAMP_TENSE = absolute ``` This setting is set to `mixed` by default, allowing dates to render as "5 hours ago". Here are some screenshots of the UI with this setting set to `absolute`:    --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: delvh <dev.lh@web.de>
Some admins prefer all timestamps to display the full date instead of relative time. They can do that now by setting
This setting is set to



mixedby default, allowing dates to render as "5 hours ago". Here are some screenshots of the UI with this setting set toabsolute: