-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add global setting how timestamps should be rendered #28657
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 <[email protected]>
custom/conf/app.example.ini
Outdated
@@ -1244,6 +1244,9 @@ LEVEL = Info | |||
;; Change the sort type of the explore pages. | |||
;; Default is "recentupdate", but you also have "alphabetically", "reverselastlogin", "newest", "oldest". | |||
;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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think other options exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, if you add a comment why relative
does not yet exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My current description is:
PREFERRED_TIMESTAMP_TENSE
: mixed: The tense all timestamps should be rendered as. Possible values areabsolute
time (i.e. 1970-01-01, 11:59) ormixed
which means some timestamps would render as relative (i.e. 2 days ago).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Today some of our timestamps are absolute and some are relative. I don't know why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some most
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 0504a8c
Signed-off-by: Yarden Shoham <[email protected]>
Co-authored-by: delvh <[email protected]> Signed-off-by: Yarden Shoham <[email protected]>
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 <[email protected]>
…estamps Signed-off-by: Yarden Shoham <[email protected]>
Co-authored-by: delvh <[email protected]>
* 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`: ![image](https://github.com/go-gitea/gitea/assets/20454870/f496457f-6afa-44be-a1e7-249ee5fe0706) ![image](https://github.com/go-gitea/gitea/assets/20454870/c03b14f5-063d-4e13-9780-76ab002d76a9) ![image](https://github.com/go-gitea/gitea/assets/20454870/f4b34e28-1546-4374-9199-c43348844edd) --------- Signed-off-by: Yarden Shoham <[email protected]> Co-authored-by: delvh <[email protected]>
- 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`: ![image](https://github.com/go-gitea/gitea/assets/20454870/f496457f-6afa-44be-a1e7-249ee5fe0706) ![image](https://github.com/go-gitea/gitea/assets/20454870/c03b14f5-063d-4e13-9780-76ab002d76a9) ![image](https://github.com/go-gitea/gitea/assets/20454870/f4b34e28-1546-4374-9199-c43348844edd) --------- Signed-off-by: Yarden Shoham <[email protected]> Co-authored-by: delvh <[email protected]>
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
mixed
by default, allowing dates to render as "5 hours ago". Here are some screenshots of the UI with this setting set toabsolute
: