@@ -114,7 +114,7 @@ func timeSincePro(then, now time.Time, lang translation.Locale) string {
114114 return strings .TrimPrefix (timeStr , ", " )
115115}
116116
117- func timeSinceUnix (then , now time.Time , lang translation.Locale , attrsMap ... map [ string ] any ) template.HTML {
117+ func timeSinceUnix (then , now time.Time , lang translation.Locale ) template.HTML {
118118 friendlyText := then .Format ("2006-01-02 15:04:05 +07:00" )
119119
120120 // document: https://github.com/github/relative-time-element
@@ -124,30 +124,18 @@ func timeSinceUnix(then, now time.Time, lang translation.Locale, attrsMap ...map
124124 attrs = `tense="future"`
125125 }
126126
127- transOnDate := ""
128- if len (attrsMap ) == 1 {
129- m := attrsMap [0 ]
130- if m ["tense" ] == "auto" {
131- attrs = `tense="auto"` // "relative-time" doesn't support i18n of "prefix", so we use our translation
132- transOnDate = lang .Tr ("tool.on_date" )
133- }
134- }
135-
136127 // declare data-tooltip-content attribute to switch from "title" tooltip to "tippy" tooltip
137128 htm := fmt .Sprintf (`<relative-time class="time-since" prefix="" %s datetime="%s" data-tooltip-content data-tooltip-interactive="true">%s</relative-time>` ,
138129 attrs , then .Format (time .RFC3339 ), friendlyText )
139- if transOnDate != "" {
140- htm = fmt .Sprintf (transOnDate , htm )
141- }
142130 return template .HTML (htm )
143131}
144132
145133// TimeSince renders relative time HTML given a time.Time
146- func TimeSince (then time.Time , lang translation.Locale , attrs ... map [ string ] any ) template.HTML {
147- return timeSinceUnix (then , time .Now (), lang , attrs ... )
134+ func TimeSince (then time.Time , lang translation.Locale ) template.HTML {
135+ return timeSinceUnix (then , time .Now (), lang )
148136}
149137
150138// TimeSinceUnix renders relative time HTML given a TimeStamp
151- func TimeSinceUnix (then TimeStamp , lang translation.Locale , extra ... map [ string ] any ) template.HTML {
152- return TimeSince (then .AsLocalTime (), lang , extra ... )
139+ func TimeSinceUnix (then TimeStamp , lang translation.Locale ) template.HTML {
140+ return TimeSince (then .AsLocalTime (), lang )
153141}
0 commit comments