Add absolute date/time display option#1990
Add absolute date/time display option#1990kounoike wants to merge 4 commits intogitbucket:masterfrom
Conversation
takezoe
left a comment
There was a problem hiding this comment.
Sorry for my slow review. This pull request conflicts subsequent pull requests. If you can resolve conflicts, I will merge this pull request for GitBucket 4.25.0.
| @@ -1,5 +1,5 @@ | |||
| @(latestUpdatedDate: java.util.Date, | |||
| recentOnly: Boolean = true) | |||
| recentOnly: Boolean = true)(implicit context: gitbucket.core.controller.Context) | |||
There was a problem hiding this comment.
It might be not necessary to provide this as Twirl template. How about moving this to helper?
There was a problem hiding this comment.
Is it means "move to gitbucket.core.view.helpers?"
There was a problem hiding this comment.
Yes, but I think we might have to consider about behavior of date formatting again because it has little complex behavior currently. For example, datetimeAgoRecentOnly returns absolute date for old dates in current implementation.
In addition, I think Date.toString() is not good solution to generate display strings.
| val value = duration / unitValue | ||
| s"${value} ${unitString}${if (value > 1) "s" else ""} ago" | ||
| case None => "just now" | ||
| def datetimeAgo(date: Date)(implicit context: Context): String = { |
There was a problem hiding this comment.
It's nice to apply that the result of this method (and also datetimeAgoRecentOnly) is changed by context.settings.relativeTime to Scaladoc comment.
# Conflicts: # src/main/scala/gitbucket/core/controller/SystemSettingsController.scala # src/main/scala/gitbucket/core/service/SystemSettingsService.scala # src/main/twirl/gitbucket/core/admin/settings_system.scala.html # src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala
This PR can close #816. Add "Absolute/Relative" time option to system settings. By default, it still uses relateive time format.
Before submitting a pull-request to GitBucket I have first: