diff options
author | Yarden Shoham <git@yardenshoham.com> | 2024-03-15 23:57:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-15 21:57:53 +0000 |
commit | 3f1e4896b6d71dc061e23fa2dcac4c1b7d412540 (patch) | |
tree | cee87803aa8e94660a7320260b6cdbb095cd633e /modules | |
parent | 397997093870226dafb70c4a3133f2ebe0fe3e2c (diff) | |
download | gitea-3f1e4896b6d71dc061e23fa2dcac4c1b7d412540.tar.gz gitea-3f1e4896b6d71dc061e23fa2dcac4c1b7d412540.zip |
Remove the `time-since` class (#29826)
It serves no purpose.
---------
Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/timeutil/datetime.go | 2 | ||||
-rw-r--r-- | modules/timeutil/since.go | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/modules/timeutil/datetime.go b/modules/timeutil/datetime.go index 3ae44cb714..c089173560 100644 --- a/modules/timeutil/datetime.go +++ b/modules/timeutil/datetime.go @@ -13,6 +13,8 @@ import ( // DateTime renders an absolute time HTML element by datetime. func DateTime(format string, datetime any, extraAttrs ...string) template.HTML { + // TODO: remove the extraAttrs argument, it's not used in any call to DateTime + if p, ok := datetime.(*time.Time); ok { datetime = *p } diff --git a/modules/timeutil/since.go b/modules/timeutil/since.go index dfaa0e3e3a..dba42c793a 100644 --- a/modules/timeutil/since.go +++ b/modules/timeutil/since.go @@ -126,7 +126,7 @@ func timeSinceUnix(then, now time.Time, _ translation.Locale) template.HTML { } // declare data-tooltip-content attribute to switch from "title" tooltip to "tippy" tooltip - htm := fmt.Sprintf(`<relative-time class="time-since" prefix="" %s datetime="%s" data-tooltip-content data-tooltip-interactive="true">%s</relative-time>`, + htm := fmt.Sprintf(`<relative-time prefix="" %s datetime="%s" data-tooltip-content data-tooltip-interactive="true">%s</relative-time>`, attrs, then.Format(time.RFC3339), friendlyText) return template.HTML(htm) } @@ -134,7 +134,7 @@ func timeSinceUnix(then, now time.Time, _ translation.Locale) template.HTML { // TimeSince renders relative time HTML given a time.Time func TimeSince(then time.Time, lang translation.Locale) template.HTML { if setting.UI.PreferredTimestampTense == "absolute" { - return DateTime("full", then, `class="time-since"`) + return DateTime("full", then) } return timeSinceUnix(then, time.Now(), lang) } |