loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PORT] Refactor DateUtils and merge TimeSince (gitea#32409)

Follow #32383 and #32402

---
Conflict resolution: Magic, painful.

(cherry picked from commit b068dbd40ee3b4dc7d18cdcf168f0c24cea234c0)

authored by

wxiaoguang and committed by
Gusted
7e1aa8a5 8f6dfe29

+241 -228
+8 -7
modules/templates/helper.go
··· 20 20 "code.gitea.io/gitea/modules/setting" 21 21 "code.gitea.io/gitea/modules/svg" 22 22 "code.gitea.io/gitea/modules/templates/eval" 23 - "code.gitea.io/gitea/modules/timeutil" 24 23 "code.gitea.io/gitea/modules/util" 25 24 "code.gitea.io/gitea/services/gitdiff" 26 25 ) ··· 65 64 66 65 // ----------------------------------------------------------------- 67 66 // time / number / format 68 - "FileSize": FileSizePanic, 69 - "CountFmt": base.FormatNumberSI, 70 - "TimeSince": timeutil.TimeSince, 71 - "TimeSinceUnix": timeutil.TimeSinceUnix, 72 - "DateTime": dateTimeLegacy, // for backward compatibility only, do not use it anymore 73 - "Sec2Time": util.SecToTime, 67 + "FileSize": FileSizePanic, 68 + "CountFmt": base.FormatNumberSI, 69 + "Sec2Time": util.SecToTime, 74 70 "LoadTimes": func(startTime time.Time) string { 75 71 return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms" 76 72 }, 73 + 74 + // for backward compatibility only, do not use them anymore 75 + "TimeSince": timeSinceLegacy, 76 + "TimeSinceUnix": timeSinceLegacy, 77 + "DateTime": dateTimeLegacy, 77 78 78 79 // ----------------------------------------------------------------- 79 80 // setting
+101 -10
modules/templates/util_date.go
··· 4 4 package templates 5 5 6 6 import ( 7 - "context" 7 + "fmt" 8 + "html" 8 9 "html/template" 10 + "strings" 9 11 "time" 10 12 11 13 "code.gitea.io/gitea/modules/setting" 12 14 "code.gitea.io/gitea/modules/timeutil" 15 + "code.gitea.io/gitea/modules/translation" 13 16 ) 14 17 15 - type DateUtils struct { 16 - ctx context.Context 17 - } 18 + type DateUtils struct{} 18 19 19 - func NewDateUtils(ctx context.Context) *DateUtils { 20 - return &DateUtils{ctx} 20 + func NewDateUtils() *DateUtils { 21 + return (*DateUtils)(nil) // the util is stateless, and we do not need to create an instance 21 22 } 22 23 23 24 // AbsoluteShort renders in "Jan 01, 2006" format 24 25 func (du *DateUtils) AbsoluteShort(time any) template.HTML { 25 - return timeutil.DateTime("short", time) 26 + return dateTimeFormat("short", time) 26 27 } 27 28 28 29 // AbsoluteLong renders in "January 01, 2006" format 29 30 func (du *DateUtils) AbsoluteLong(time any) template.HTML { 30 - return timeutil.DateTime("long", time) 31 + return dateTimeFormat("long", time) 31 32 } 32 33 33 34 // FullTime renders in "Jan 01, 2006 20:33:44" format 34 35 func (du *DateUtils) FullTime(time any) template.HTML { 35 - return timeutil.DateTime("full", time) 36 + return dateTimeFormat("full", time) 37 + } 38 + 39 + func (du *DateUtils) TimeSince(time any) template.HTML { 40 + return TimeSince(time) 36 41 } 37 42 38 43 // ParseLegacy parses the datetime in legacy format, eg: "2016-01-02" in server's timezone. ··· 56 61 if s, ok := datetime.(string); ok { 57 62 datetime = parseLegacy(s) 58 63 } 59 - return timeutil.DateTime(format, datetime) 64 + return dateTimeFormat(format, datetime) 65 + } 66 + 67 + func timeSinceLegacy(time any, _ translation.Locale) template.HTML { 68 + if !setting.IsProd || setting.IsInTesting { 69 + panic("timeSinceLegacy is for backward compatibility only, do not use it in new code") 70 + } 71 + return TimeSince(time) 72 + } 73 + 74 + func anyToTime(any any) (t time.Time, isZero bool) { 75 + switch v := any.(type) { 76 + case nil: 77 + // it is zero 78 + case *time.Time: 79 + if v != nil { 80 + t = *v 81 + } 82 + case time.Time: 83 + t = v 84 + case timeutil.TimeStamp: 85 + t = v.AsTime() 86 + case timeutil.TimeStampNano: 87 + t = v.AsTime() 88 + case int: 89 + t = timeutil.TimeStamp(v).AsTime() 90 + case int64: 91 + t = timeutil.TimeStamp(v).AsTime() 92 + default: 93 + panic(fmt.Sprintf("Unsupported time type %T", any)) 94 + } 95 + return t, t.IsZero() || t.Unix() == 0 96 + } 97 + 98 + func dateTimeFormat(format string, datetime any) template.HTML { 99 + t, isZero := anyToTime(datetime) 100 + if isZero { 101 + return "-" 102 + } 103 + var textEscaped string 104 + datetimeEscaped := html.EscapeString(t.Format(time.RFC3339)) 105 + if format == "full" { 106 + textEscaped = html.EscapeString(t.Format("2006-01-02 15:04:05 -07:00")) 107 + } else { 108 + textEscaped = html.EscapeString(t.Format("2006-01-02")) 109 + } 110 + 111 + attrs := []string{`weekday=""`, `year="numeric"`} 112 + switch format { 113 + case "short", "long": // date only 114 + attrs = append(attrs, `month="`+format+`"`, `day="numeric"`) 115 + return template.HTML(fmt.Sprintf(`<absolute-date %s date="%s">%s</absolute-date>`, strings.Join(attrs, " "), datetimeEscaped, textEscaped)) 116 + case "full": // full date including time 117 + attrs = append(attrs, `format="datetime"`, `month="short"`, `day="numeric"`, `hour="numeric"`, `minute="numeric"`, `second="numeric"`, `data-tooltip-content`, `data-tooltip-interactive="true"`) 118 + return template.HTML(fmt.Sprintf(`<relative-time %s datetime="%s">%s</relative-time>`, strings.Join(attrs, " "), datetimeEscaped, textEscaped)) 119 + default: 120 + panic(fmt.Sprintf("Unsupported format %s", format)) 121 + } 122 + } 123 + 124 + func timeSinceTo(then any, now time.Time) template.HTML { 125 + thenTime, isZero := anyToTime(then) 126 + if isZero { 127 + return "-" 128 + } 129 + 130 + friendlyText := thenTime.Format("2006-01-02 15:04:05 -07:00") 131 + 132 + // document: https://github.com/github/relative-time-element 133 + attrs := `tense="past"` 134 + isFuture := now.Before(thenTime) 135 + if isFuture { 136 + attrs = `tense="future"` 137 + } 138 + 139 + // declare data-tooltip-content attribute to switch from "title" tooltip to "tippy" tooltip 140 + htm := fmt.Sprintf(`<relative-time prefix="" %s datetime="%s" data-tooltip-content data-tooltip-interactive="true">%s</relative-time>`, 141 + attrs, thenTime.Format(time.RFC3339), friendlyText) 142 + return template.HTML(htm) 143 + } 144 + 145 + // TimeSince renders relative time HTML given a time 146 + func TimeSince(then any) template.HTML { 147 + if setting.UI.PreferredTimestampTense == "absolute" { 148 + return dateTimeFormat("full", then) 149 + } 150 + return timeSinceTo(then, time.Now()) 60 151 }
+22 -1
modules/templates/util_date_test.go
··· 22 22 defer test.MockVariableValue(&setting.DefaultUILocation, testTz)() 23 23 defer test.MockVariableValue(&setting.IsInTesting, false)() 24 24 25 - du := NewDateUtils(nil) 25 + du := NewDateUtils() 26 26 27 27 refTimeStr := "2018-01-01T00:00:00Z" 28 28 refDateStr := "2018-01-01" ··· 59 59 actual = du.FullTime(refTimeStamp) 60 60 assert.EqualValues(t, `<relative-time weekday="" year="numeric" format="datetime" month="short" day="numeric" hour="numeric" minute="numeric" second="numeric" data-tooltip-content data-tooltip-interactive="true" datetime="2017-12-31T19:00:00-05:00">2017-12-31 19:00:00 -05:00</relative-time>`, actual) 61 61 } 62 + 63 + func TestTimeSince(t *testing.T) { 64 + testTz, _ := time.LoadLocation("America/New_York") 65 + defer test.MockVariableValue(&setting.DefaultUILocation, testTz)() 66 + defer test.MockVariableValue(&setting.IsInTesting, false)() 67 + 68 + du := NewDateUtils() 69 + assert.EqualValues(t, "-", du.TimeSince(nil)) 70 + 71 + refTimeStr := "2018-01-01T00:00:00Z" 72 + refTime, _ := time.Parse(time.RFC3339, refTimeStr) 73 + 74 + actual := du.TimeSince(refTime) 75 + assert.EqualValues(t, `<relative-time prefix="" tense="past" datetime="2018-01-01T00:00:00Z" data-tooltip-content data-tooltip-interactive="true">2018-01-01 00:00:00 +00:00</relative-time>`, actual) 76 + 77 + actual = timeSinceTo(&refTime, time.Time{}) 78 + assert.EqualValues(t, `<relative-time prefix="" tense="future" datetime="2018-01-01T00:00:00Z" data-tooltip-content data-tooltip-interactive="true">2018-01-01 00:00:00 +00:00</relative-time>`, actual) 79 + 80 + actual = timeSinceLegacy(timeutil.TimeStampNano(refTime.UnixNano()), nil) 81 + assert.EqualValues(t, `<relative-time prefix="" tense="past" datetime="2017-12-31T19:00:00-05:00" data-tooltip-content data-tooltip-interactive="true">2017-12-31 19:00:00 -05:00</relative-time>`, actual) 82 + }
-60
modules/timeutil/datetime.go
··· 1 - // Copyright 2023 The Gitea Authors. All rights reserved. 2 - // SPDX-License-Identifier: MIT 3 - 4 - package timeutil 5 - 6 - import ( 7 - "fmt" 8 - "html" 9 - "html/template" 10 - "strings" 11 - "time" 12 - ) 13 - 14 - // DateTime renders an absolute time HTML element by datetime. 15 - func DateTime(format string, datetime any) template.HTML { 16 - if p, ok := datetime.(*time.Time); ok { 17 - datetime = *p 18 - } 19 - if p, ok := datetime.(*TimeStamp); ok { 20 - datetime = *p 21 - } 22 - switch v := datetime.(type) { 23 - case TimeStamp: 24 - datetime = v.AsTime() 25 - case int: 26 - datetime = TimeStamp(v).AsTime() 27 - case int64: 28 - datetime = TimeStamp(v).AsTime() 29 - } 30 - 31 - var datetimeEscaped, textEscaped string 32 - switch v := datetime.(type) { 33 - case nil: 34 - return "-" 35 - case time.Time: 36 - if v.IsZero() || v.Unix() == 0 { 37 - return "-" 38 - } 39 - datetimeEscaped = html.EscapeString(v.Format(time.RFC3339)) 40 - if format == "full" { 41 - textEscaped = html.EscapeString(v.Format("2006-01-02 15:04:05 -07:00")) 42 - } else { 43 - textEscaped = html.EscapeString(v.Format("2006-01-02")) 44 - } 45 - default: 46 - panic(fmt.Sprintf("Unsupported time type %T", datetime)) 47 - } 48 - 49 - attrs := []string{`weekday=""`, `year="numeric"`} 50 - switch format { 51 - case "short", "long": // date only 52 - attrs = append(attrs, `month="`+format+`"`, `day="numeric"`) 53 - return template.HTML(fmt.Sprintf(`<absolute-date %s date="%s">%s</absolute-date>`, strings.Join(attrs, " "), datetimeEscaped, textEscaped)) 54 - case "full": // full date including time 55 - attrs = append(attrs, `format="datetime"`, `month="short"`, `day="numeric"`, `hour="numeric"`, `minute="numeric"`, `second="numeric"`, `data-tooltip-content`, `data-tooltip-interactive="true"`) 56 - return template.HTML(fmt.Sprintf(`<relative-time %s datetime="%s">%s</relative-time>`, strings.Join(attrs, " "), datetimeEscaped, textEscaped)) 57 - default: 58 - panic(fmt.Sprintf("Unsupported format %s", format)) 59 - } 60 - }
+2 -39
modules/timeutil/since.go
··· 4 4 package timeutil 5 5 6 6 import ( 7 - "fmt" 8 - "html/template" 9 7 "strings" 10 8 "time" 11 9 12 - "code.gitea.io/gitea/modules/setting" 13 10 "code.gitea.io/gitea/modules/translation" 14 11 ) 15 12 ··· 81 78 return diff, diffStr 82 79 } 83 80 84 - // MinutesToFriendly returns a user friendly string with number of minutes 81 + // MinutesToFriendly returns a user-friendly string with number of minutes 85 82 // converted to hours and minutes. 86 83 func MinutesToFriendly(minutes int, lang translation.Locale) string { 87 84 duration := time.Duration(minutes) * time.Minute 88 - return TimeSincePro(time.Now().Add(-duration), lang) 89 - } 90 - 91 - // TimeSincePro calculates the time interval and generate full user-friendly string. 92 - func TimeSincePro(then time.Time, lang translation.Locale) string { 93 - return timeSincePro(then, time.Now(), lang) 85 + return timeSincePro(time.Now().Add(-duration), time.Now(), lang) 94 86 } 95 87 96 88 func timeSincePro(then, now time.Time, lang translation.Locale) string { ··· 114 106 } 115 107 return strings.TrimPrefix(timeStr, ", ") 116 108 } 117 - 118 - func timeSinceUnix(then, now time.Time, _ translation.Locale) template.HTML { 119 - friendlyText := then.Format("2006-01-02 15:04:05 -07:00") 120 - 121 - // document: https://github.com/github/relative-time-element 122 - attrs := `tense="past"` 123 - isFuture := now.Before(then) 124 - if isFuture { 125 - attrs = `tense="future"` 126 - } 127 - 128 - // declare data-tooltip-content attribute to switch from "title" tooltip to "tippy" tooltip 129 - htm := fmt.Sprintf(`<relative-time prefix="" %s datetime="%s" data-tooltip-content data-tooltip-interactive="true">%s</relative-time>`, 130 - attrs, then.Format(time.RFC3339), friendlyText) 131 - return template.HTML(htm) 132 - } 133 - 134 - // TimeSince renders relative time HTML given a time.Time 135 - func TimeSince(then time.Time, lang translation.Locale) template.HTML { 136 - if setting.UI.PreferredTimestampTense == "absolute" { 137 - return DateTime("full", then) 138 - } 139 - return timeSinceUnix(then, time.Now(), lang) 140 - } 141 - 142 - // TimeSinceUnix renders relative time HTML given a TimeStamp 143 - func TimeSinceUnix(then TimeStamp, lang translation.Locale) template.HTML { 144 - return TimeSince(then.AsLocalTime(), lang) 145 - }
+1 -2
routers/web/repo/blame.go
··· 17 17 "code.gitea.io/gitea/modules/log" 18 18 "code.gitea.io/gitea/modules/setting" 19 19 "code.gitea.io/gitea/modules/templates" 20 - "code.gitea.io/gitea/modules/timeutil" 21 20 "code.gitea.io/gitea/modules/util" 22 21 "code.gitea.io/gitea/services/context" 23 22 files_service "code.gitea.io/gitea/services/repository/files" ··· 254 253 commitCnt++ 255 254 256 255 // User avatar image 257 - commitSince := timeutil.TimeSinceUnix(timeutil.TimeStamp(commit.Author.When.Unix()), ctx.Locale) 256 + commitSince := templates.TimeSince(commit.Author.When) 258 257 259 258 var avatar string 260 259 if commit.User != nil {
+2 -3
routers/web/repo/issue_content_history.go
··· 14 14 "code.gitea.io/gitea/modules/log" 15 15 "code.gitea.io/gitea/modules/setting" 16 16 "code.gitea.io/gitea/modules/templates" 17 - "code.gitea.io/gitea/modules/timeutil" 18 17 "code.gitea.io/gitea/services/context" 19 18 20 19 "github.com/sergi/go-diff/diffmatchpatch" ··· 73 72 class := avatars.DefaultAvatarClass + " tw-mr-2" 74 73 name := html.EscapeString(username) 75 74 avatarHTML := string(templates.AvatarHTML(src, 28, class, username)) 76 - timeSinceText := string(timeutil.TimeSinceUnix(item.EditedUnix, ctx.Locale)) 75 + timeSinceHTML := string(templates.TimeSince(item.EditedUnix)) 77 76 78 77 results = append(results, map[string]any{ 79 - "name": avatarHTML + "<strong>" + name + "</strong> " + actionText + " " + timeSinceText, 78 + "name": avatarHTML + "<strong>" + name + "</strong> " + actionText + " " + timeSinceHTML, 80 79 "value": item.HistoryID, 81 80 }) 82 81 }
-1
services/context/context.go
··· 102 102 tmplCtx := NewTemplateContext(ctx) 103 103 tmplCtx["Locale"] = ctx.Base.Locale 104 104 tmplCtx["AvatarUtils"] = templates.NewAvatarUtils(ctx) 105 - tmplCtx["DateUtils"] = templates.NewDateUtils(ctx) 106 105 return tmplCtx 107 106 } 108 107
+2 -2
templates/admin/auth/list.tmpl
··· 26 26 <td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{.Name}}</a></td> 27 27 <td>{{.TypeName}}</td> 28 28 <td>{{if .IsActive}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> 29 - <td>{{ctx.DateUtils.AbsoluteShort .UpdatedUnix}}</td> 30 - <td>{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</td> 29 + <td>{{DateUtils.AbsoluteShort .UpdatedUnix}}</td> 30 + <td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td> 31 31 <td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{svg "octicon-pencil"}}</a></td> 32 32 </tr> 33 33 {{end}}
+2 -2
templates/admin/cron.tmpl
··· 23 23 <td><button type="submit" class="ui primary button" name="op" value="{{.Name}}" title="{{ctx.Locale.Tr "admin.dashboard.operation_run"}}">{{svg "octicon-triangle-right"}}</button></td> 24 24 <td>{{ctx.Locale.Tr (printf "admin.dashboard.%s" .Name)}}</td> 25 25 <td>{{.Spec}}</td> 26 - <td>{{ctx.DateUtils.FullTime .Next}}</td> 27 - <td>{{if gt .Prev.Year 1}}{{ctx.DateUtils.FullTime .Prev}}{{else}}-{{end}}</td> 26 + <td>{{DateUtils.FullTime .Next}}</td> 27 + <td>{{if gt .Prev.Year 1}}{{DateUtils.FullTime .Prev}}{{else}}-{{end}}</td> 28 28 <td>{{.ExecTimes}}</td> 29 29 <td {{if ne .Status ""}}data-tooltip-content="{{.FormatLastMessage ctx.Locale}}"{{end}} >{{if eq .Status ""}}—{{else if eq .Status "finished"}}{{svg "octicon-check" 16}}{{else}}{{svg "octicon-x" 16}}{{end}}</td> 30 30 </tr>
+1 -1
templates/admin/notice.tmpl
··· 21 21 <td>{{.ID}}</td> 22 22 <td>{{ctx.Locale.Tr .TrStr}}</td> 23 23 <td class="view-detail auto-ellipsis tw-w-4/5"><span class="notice-description">{{.Description}}</span></td> 24 - <td nowrap>{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</td> 24 + <td nowrap>{{DateUtils.AbsoluteShort .CreatedUnix}}</td> 25 25 <td class="view-detail"><a href="#">{{svg "octicon-note" 16}}</a></td> 26 26 </tr> 27 27 {{end}}
+1 -1
templates/admin/org/list.tmpl
··· 63 63 <td>{{.NumTeams}}</td> 64 64 <td>{{.NumMembers}}</td> 65 65 <td>{{.NumRepos}}</td> 66 - <td>{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</td> 66 + <td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td> 67 67 <td><a href="{{.OrganisationLink}}/settings" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a></td> 68 68 </tr> 69 69 {{end}}
+1 -1
templates/admin/packages/list.tmpl
··· 71 71 {{end}} 72 72 </td> 73 73 <td>{{ctx.Locale.TrSize .CalculateBlobSize}}</td> 74 - <td>{{ctx.DateUtils.AbsoluteShort .Version.CreatedUnix}}</td> 74 + <td>{{DateUtils.AbsoluteShort .Version.CreatedUnix}}</td> 75 75 <td><a class="delete-button" href="" data-url="{{$.Link}}/delete?page={{$.Page.Paginater.Current}}&sort={{$.SortType}}" data-id="{{.Version.ID}}" data-name="{{.Package.Name}}" data-data-version="{{.Version.Version}}">{{svg "octicon-trash"}}</a></td> 76 76 </tr> 77 77 {{end}}
+2 -2
templates/admin/repo/list.tmpl
··· 82 82 <td>{{.NumIssues}}</td> 83 83 <td>{{ctx.Locale.TrSize .GitSize}}</td> 84 84 <td>{{ctx.Locale.TrSize .LFSSize}}</td> 85 - <td>{{ctx.DateUtils.AbsoluteShort .UpdatedUnix}}</td> 86 - <td>{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</td> 85 + <td>{{DateUtils.AbsoluteShort .UpdatedUnix}}</td> 86 + <td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td> 87 87 <td><a class="delete-button" href="" data-url="{{$.Link}}/delete?page={{$.Page.Paginater.Current}}&sort={{$.SortType}}" data-id="{{.ID}}" data-name="{{.Name}}">{{svg "octicon-trash"}}</a></td> 88 88 </tr> 89 89 {{end}}
+1 -1
templates/admin/stacktrace-row.tmpl
··· 13 13 </div> 14 14 <div class="content tw-flex-1"> 15 15 <div class="header">{{.Process.Description}}</div> 16 - <div class="description">{{if ne .Process.Type "none"}}{{TimeSince .Process.Start ctx.Locale}}{{end}}</div> 16 + <div class="description">{{if ne .Process.Type "none"}}{{DateUtils.TimeSince .Process.Start}}{{end}}</div> 17 17 </div> 18 18 <div> 19 19 {{if or (eq .Process.Type "request") (eq .Process.Type "normal")}}
+2 -2
templates/admin/user/list.tmpl
··· 96 96 <td>{{if .IsActive}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> 97 97 <td>{{if .IsRestricted}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> 98 98 <td>{{if index $.UsersTwoFaStatus .ID}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> 99 - <td>{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</td> 99 + <td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td> 100 100 {{if .LastLoginUnix}} 101 - <td>{{ctx.DateUtils.AbsoluteShort .LastLoginUnix}}</td> 101 + <td>{{DateUtils.AbsoluteShort .LastLoginUnix}}</td> 102 102 {{else}} 103 103 <td><span>{{ctx.Locale.Tr "admin.users.never_login"}}</span></td> 104 104 {{end}}
+7 -7
templates/devtest/gitea-ui.tmpl
··· 167 167 168 168 <div> 169 169 <h1>TimeSince</h1> 170 - <div>Now: {{TimeSince .TimeNow ctx.Locale}}</div> 171 - <div>5s past: {{TimeSince .TimePast5s ctx.Locale}}</div> 172 - <div>5s future: {{TimeSince .TimeFuture5s ctx.Locale}}</div> 173 - <div>2m past: {{TimeSince .TimePast2m ctx.Locale}}</div> 174 - <div>2m future: {{TimeSince .TimeFuture2m ctx.Locale}}</div> 175 - <div>1y past: {{TimeSince .TimePast1y ctx.Locale}}</div> 176 - <div>1y future: {{TimeSince .TimeFuture1y ctx.Locale}}</div> 170 + <div>Now: {{DateUtils.TimeSince .TimeNow}}</div> 171 + <div>5s past: {{DateUtils.TimeSince .TimePast5s}}</div> 172 + <div>5s future: {{DateUtils.TimeSince .TimeFuture5s}}</div> 173 + <div>2m past: {{DateUtils.TimeSince .TimePast2m}}</div> 174 + <div>2m future: {{DateUtils.TimeSince .TimeFuture2m}}</div> 175 + <div>1y past: {{DateUtils.TimeSince .TimePast1y}}</div> 176 + <div>1y future: {{DateUtils.TimeSince .TimeFuture1y}}</div> 177 177 </div> 178 178 179 179 <div>
+1 -1
templates/explore/repo_list.tmpl
··· 62 62 {{end}} 63 63 </div> 64 64 {{end}} 65 - <div class="flex-item-body">{{ctx.Locale.Tr "org.repo_updated" (TimeSinceUnix .UpdatedUnix ctx.Locale)}}</div> 65 + <div class="flex-item-body">{{ctx.Locale.Tr "org.repo_updated" (DateUtils.TimeSince .UpdatedUnix)}}</div> 66 66 </div> 67 67 </div> 68 68 {{else}}
+1 -1
templates/explore/user_list.tmpl
··· 21 21 <a href="mailto:{{.Email}}">{{.Email}}</a> 22 22 </span> 23 23 {{end}} 24 - <span class="flex-text-inline">{{svg "octicon-calendar"}}{{ctx.Locale.Tr "user.joined_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}}</span> 24 + <span class="flex-text-inline">{{svg "octicon-calendar"}}{{ctx.Locale.Tr "user.joined_on" (DateUtils.AbsoluteShort .CreatedUnix)}}</span> 25 25 </div> 26 26 </div> 27 27 </div>
+1 -1
templates/package/shared/cleanup_rules/preview.tmpl
··· 22 22 <td><a href="{{.VersionWebLink}}">{{.Version.Version}}</a></td> 23 23 <td><a href="{{.Creator.HomeLink}}">{{.Creator.Name}}</a></td> 24 24 <td>{{ctx.Locale.TrSize .CalculateBlobSize}}</td> 25 - <td>{{ctx.DateUtils.AbsoluteShort .Version.CreatedUnix}}</td> 25 + <td>{{DateUtils.AbsoluteShort .Version.CreatedUnix}}</td> 26 26 </tr> 27 27 {{else}} 28 28 <tr>
+1 -1
templates/package/shared/list.tmpl
··· 24 24 <span class="ui label">{{svg .Package.Type.SVGName 16}} {{.Package.Type.Name}}</span> 25 25 </div> 26 26 <div class="flex-item-body"> 27 - {{$timeStr := TimeSinceUnix .Version.CreatedUnix ctx.Locale}} 27 + {{$timeStr := DateUtils.TimeSince .Version.CreatedUnix}} 28 28 {{$hasRepositoryAccess := false}} 29 29 {{if .Repository}} 30 30 {{$hasRepositoryAccess = index $.RepositoryAccessMap .Repository.ID}}
+1 -1
templates/package/shared/versionlist.tmpl
··· 25 25 <div class="flex-item-main"> 26 26 <a class="flex-item-title" href="{{.VersionWebLink}}">{{.Version.LowerVersion}}</a> 27 27 <div class="flex-item-body"> 28 - {{ctx.Locale.Tr "packages.published_by" (TimeSinceUnix .Version.CreatedUnix ctx.Locale) .Creator.HomeLink .Creator.GetDisplayName}} 28 + {{ctx.Locale.Tr "packages.published_by" (DateUtils.TimeSince .Version.CreatedUnix) .Creator.HomeLink .Creator.GetDisplayName}} 29 29 </div> 30 30 </div> 31 31 </div>
+3 -3
templates/package/view.tmpl
··· 8 8 <h1>{{.PackageDescriptor.Package.Name}} ({{.PackageDescriptor.Version.Version}})</h1> 9 9 </div> 10 10 <div> 11 - {{$timeStr := TimeSinceUnix .PackageDescriptor.Version.CreatedUnix ctx.Locale}} 11 + {{$timeStr := DateUtils.TimeSince .PackageDescriptor.Version.CreatedUnix}} 12 12 {{if .HasRepositoryAccess}} 13 13 {{ctx.Locale.Tr "packages.published_by_in" $timeStr .PackageDescriptor.Creator.HomeLink .PackageDescriptor.Creator.GetDisplayName .PackageDescriptor.Repository.Link .PackageDescriptor.Repository.FullName}} 14 14 {{else}} ··· 48 48 {{if .HasRepositoryAccess}} 49 49 <div class="item">{{svg "octicon-repo" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Repository.Link}}">{{.PackageDescriptor.Repository.FullName}}</a></div> 50 50 {{end}} 51 - <div class="item">{{svg "octicon-calendar" 16 "tw-mr-2"}} {{TimeSinceUnix .PackageDescriptor.Version.CreatedUnix ctx.Locale}}</div> 51 + <div class="item">{{svg "octicon-calendar" 16 "tw-mr-2"}} {{DateUtils.TimeSince .PackageDescriptor.Version.CreatedUnix}}</div> 52 52 <div class="item">{{svg "octicon-download" 16 "tw-mr-2"}} {{.PackageDescriptor.Version.DownloadCount}}</div> 53 53 {{template "package/metadata/alpine" .}} 54 54 {{template "package/metadata/arch" .}} ··· 94 94 {{range .LatestVersions}} 95 95 <div class="item tw-flex"> 96 96 <a class="tw-flex-1 gt-ellipsis" title="{{.Version}}" href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .LowerVersion}}">{{.Version}}</a> 97 - <span class="text small">{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</span> 97 + <span class="text small">{{DateUtils.AbsoluteShort .CreatedUnix}}</span> 98 98 </div> 99 99 {{end}} 100 100 </div>
+1 -1
templates/repo/actions/runs_list.tmpl
··· 33 33 <span class="ui label run-list-ref gt-ellipsis">{{.PrettyRef}}</span> 34 34 {{end}} 35 35 <div class="run-list-item-right"> 36 - <div class="run-list-meta">{{svg "octicon-calendar" 16}}{{TimeSinceUnix .Updated ctx.Locale}}</div> 36 + <div class="run-list-meta">{{svg "octicon-calendar" 16}}{{DateUtils.TimeSince .Updated}}</div> 37 37 <div class="run-list-meta">{{svg "octicon-stopwatch" 16}}{{.Duration}}</div> 38 38 </div> 39 39 </div>
+3 -3
templates/repo/branch/list.tmpl
··· 27 27 <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> 28 28 {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}} 29 29 </div> 30 - <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DefaultBranchBranch.DBBranch.CommitMessage (.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated" (TimeSince .DefaultBranchBranch.DBBranch.CommitTime.AsTime ctx.Locale)}} {{if .DefaultBranchBranch.DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p> 30 + <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DefaultBranchBranch.DBBranch.CommitMessage (.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated" (DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime)}}{{if .DefaultBranchBranch.DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p> 31 31 </td> 32 32 <td class="right aligned middle aligned overflow-visible"> 33 33 {{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}} ··· 92 92 <span class="gt-ellipsis">{{.DBBranch.Name}}</span> 93 93 <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> 94 94 </div> 95 - <p class="info">{{ctx.Locale.Tr "repo.branch.deleted_by" .DBBranch.DeletedBy.Name}} {{TimeSinceUnix .DBBranch.DeletedUnix ctx.Locale}}</p> 95 + <p class="info">{{ctx.Locale.Tr "repo.branch.deleted_by" .DBBranch.DeletedBy.Name}} {{DateUtils.TimeSince .DBBranch.DeletedUnix}}</p> 96 96 {{else}} 97 97 <div class="flex-text-block"> 98 98 <a class="gt-ellipsis" href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments .DBBranch.Name}}">{{.DBBranch.Name}}</a> ··· 102 102 <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> 103 103 {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DBBranch.CommitID)}} 104 104 </div> 105 - <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DBBranch.CommitMessage ($.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated" (TimeSince .DBBranch.CommitTime.AsTime ctx.Locale)}} {{if .DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} &nbsp;{{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p> 105 + <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DBBranch.CommitMessage ($.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated" (DateUtils.TimeSince .DBBranch.CommitTime)}}{{if .DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} &nbsp;{{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p> 106 106 {{end}} 107 107 </td> 108 108 <td class="two wide ui">
+1 -1
templates/repo/code/recently_pushed_new_branches.tmpl
··· 1 1 {{range .RecentlyPushedNewBranches}} 2 2 <div class="ui positive message tw-flex tw-items-center tw-gap-2"> 3 3 <div class="tw-flex-1 tw-break-anywhere"> 4 - {{$timeSince := TimeSince .CommitTime.AsTime ctx.Locale}} 4 + {{$timeSince := DateUtils.TimeSince .CommitTime}} 5 5 {{$repo := .GetRepo $.Context}} 6 6 {{$name := .Name}} 7 7 {{if ne $repo.ID $.Repository.ID}}
+2 -2
templates/repo/commit_page.tmpl
··· 152 152 {{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 28 "tw-mr-2"}} 153 153 <strong>{{.Commit.Author.Name}}</strong> 154 154 {{end}} 155 - <span class="text grey tw-ml-2" id="authored-time">{{TimeSince .Commit.Author.When ctx.Locale}}</span> 155 + <span class="text grey tw-ml-2" id="authored-time">{{DateUtils.TimeSince .Commit.Author.When}}</span> 156 156 {{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}} 157 157 <span class="tw-ml-2">•</span> 158 158 <span class="text grey tw-mx-2">{{ctx.Locale.Tr "repo.diff.committed_by"}}</span> ··· 274 274 {{else}} 275 275 <strong>{{.NoteCommit.Author.Name}}</strong> 276 276 {{end}} 277 - <span class="text grey" id="note-authored-time">{{TimeSince .NoteCommit.Author.When ctx.Locale}}</span> 277 + <span class="text grey" id="note-authored-time">{{DateUtils.TimeSince .NoteCommit.Author.When}}</span> 278 278 </div> 279 279 <div class="ui bottom attached info segment git-notes"> 280 280 <pre class="commit-body">{{.NoteRendered | SanitizeHTML}}</pre>
+2 -2
templates/repo/commits_list.tmpl
··· 74 74 {{end}} 75 75 </td> 76 76 {{if .Committer}} 77 - <td class="text right aligned">{{TimeSince .Committer.When ctx.Locale}}</td> 77 + <td class="text right aligned">{{DateUtils.TimeSince .Committer.When}}</td> 78 78 {{else}} 79 - <td class="text right aligned">{{TimeSince .Author.When ctx.Locale}}</td> 79 + <td class="text right aligned">{{DateUtils.TimeSince .Author.When}}</td> 80 80 {{end}} 81 81 <td class="text right aligned tw-py-0"> 82 82 <button class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button>
+1 -1
templates/repo/diff/comments.tmpl
··· 1 1 {{range .comments}} 2 2 3 - {{$createdStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} 3 + {{$createdStr:= DateUtils.TimeSince .CreatedUnix}} 4 4 <div class="comment" id="{{.HashTag}}"> 5 5 {{if .OriginalAuthor}} 6 6 <span class="avatar">{{ctx.AvatarUtils.Avatar nil}}</span>
+1 -1
templates/repo/diff/compare.tmpl
··· 212 212 {{if .Repository.ArchivedUnix.IsZero}} 213 213 {{ctx.Locale.Tr "repo.archive.title"}} 214 214 {{else}} 215 - {{ctx.Locale.Tr "repo.archive.title_date" (ctx.DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} 215 + {{ctx.Locale.Tr "repo.archive.title_date" (DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} 216 216 {{end}} 217 217 </div> 218 218 {{end}}
+1 -1
templates/repo/empty.tmpl
··· 10 10 {{if .Repository.ArchivedUnix.IsZero}} 11 11 {{ctx.Locale.Tr "repo.archive.title"}} 12 12 {{else}} 13 - {{ctx.Locale.Tr "repo.archive.title_date" (ctx.DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} 13 + {{ctx.Locale.Tr "repo.archive.title_date" (DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} 14 14 {{end}} 15 15 </div> 16 16 {{end}}
+1 -1
templates/repo/graph/commits.tmpl
··· 71 71 {{$userName}} 72 72 {{end}} 73 73 </span> 74 - <span class="time tw-flex tw-items-center">{{ctx.DateUtils.FullTime $commit.Date}}</span> 74 + <span class="time tw-flex tw-items-center">{{DateUtils.FullTime $commit.Date}}</span> 75 75 {{end}} 76 76 </li> 77 77 {{end}}
+1 -1
templates/repo/header.tmpl
··· 74 74 <div class="fork-flag"> 75 75 {{ctx.Locale.Tr "repo.mirror_from"}} 76 76 <a target="_blank" rel="noopener noreferrer" href="{{$.PullMirror.RemoteAddress}}">{{$.PullMirror.RemoteAddress}}</a> 77 - {{if $.PullMirror.UpdatedUnix}}{{ctx.Locale.Tr "repo.mirror_sync"}} {{TimeSinceUnix $.PullMirror.UpdatedUnix ctx.Locale}}{{end}} 77 + {{if $.PullMirror.UpdatedUnix}}{{ctx.Locale.Tr "repo.mirror_sync"}} {{DateUtils.TimeSince $.PullMirror.UpdatedUnix}}{{end}} 78 78 </div> 79 79 {{end}} 80 80 {{if .IsFork}}<div class="fork-flag">{{ctx.Locale.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}}
+1 -1
templates/repo/home.tmpl
··· 53 53 {{if .Repository.ArchivedUnix.IsZero}} 54 54 {{ctx.Locale.Tr "repo.archive.title"}} 55 55 {{else}} 56 - {{ctx.Locale.Tr "repo.archive.title_date" (ctx.DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} 56 + {{ctx.Locale.Tr "repo.archive.title_date" (DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} 57 57 {{end}} 58 58 </div> 59 59 {{end}}
+1 -1
templates/repo/issue/card.tmpl
··· 24 24 <div class="meta"> 25 25 <span class="text light grey muted-links"> 26 26 {{if not $.Page.Repository}}{{.Repo.FullName}}{{end}}#{{.Index}} 27 - {{$timeStr := TimeSinceUnix .GetLastEventTimestamp ctx.Locale}} 27 + {{$timeStr := DateUtils.TimeSince .GetLastEventTimestamp}} 28 28 {{if .OriginalAuthor}} 29 29 {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor}} 30 30 {{else if gt .Poster.ID 0}}
+2 -2
templates/repo/issue/milestone_issues.tmpl
··· 30 30 <progress class="milestone-progress-big" value="{{.Milestone.Completeness}}" max="100"></progress> 31 31 <div class="tw-flex tw-gap-4"> 32 32 <div class="tw-flex tw-items-center"> 33 - {{$closedDate:= TimeSinceUnix .Milestone.ClosedDateUnix ctx.Locale}} 33 + {{$closedDate:= DateUtils.TimeSince .Milestone.ClosedDateUnix}} 34 34 {{if .IsClosed}} 35 35 {{svg "octicon-clock"}} {{ctx.Locale.Tr "repo.milestones.closed" $closedDate}} 36 36 {{else}} ··· 38 38 {{if .Milestone.DeadlineString}} 39 39 <span{{if .IsOverdue}} class="text red"{{end}}> 40 40 {{svg "octicon-calendar"}} 41 - {{ctx.DateUtils.AbsoluteShort (.Milestone.DeadlineString|ctx.DateUtils.ParseLegacy)}} 41 + {{DateUtils.AbsoluteShort (.Milestone.DeadlineString|DateUtils.ParseLegacy)}} 42 42 </span> 43 43 {{else}} 44 44 {{svg "octicon-calendar"}}
+3 -3
templates/repo/issue/milestones.tmpl
··· 49 49 {{if .UpdatedUnix}} 50 50 <div class="flex-text-block"> 51 51 {{svg "octicon-clock"}} 52 - {{ctx.Locale.Tr "repo.milestones.update_ago" (TimeSinceUnix .UpdatedUnix ctx.Locale)}} 52 + {{ctx.Locale.Tr "repo.milestones.update_ago" (DateUtils.TimeSince .UpdatedUnix)}} 53 53 </div> 54 54 {{end}} 55 55 <div class="flex-text-block"> 56 56 {{if .IsClosed}} 57 - {{$closedDate:= TimeSinceUnix .ClosedDateUnix ctx.Locale}} 57 + {{$closedDate:= DateUtils.TimeSince .ClosedDateUnix}} 58 58 {{svg "octicon-clock" 14}} 59 59 {{ctx.Locale.Tr "repo.milestones.closed" $closedDate}} 60 60 {{else}} 61 61 {{if .DeadlineString}} 62 62 <span class="flex-text-inline {{if .IsOverdue}}text red{{end}}"> 63 63 {{svg "octicon-calendar" 14}} 64 - {{ctx.DateUtils.AbsoluteShort (.DeadlineString|ctx.DateUtils.ParseLegacy)}} 64 + {{DateUtils.AbsoluteShort (.DeadlineString|DateUtils.ParseLegacy)}} 65 65 </span> 66 66 {{else}} 67 67 {{svg "octicon-calendar" 14}}
+1 -1
templates/repo/issue/view_content.tmpl
··· 6 6 <input type="hidden" id="issueIndex" value="{{.Issue.Index}}"> 7 7 <input type="hidden" id="type" value="{{.IssueType}}"> 8 8 9 - {{$createdStr:= TimeSinceUnix .Issue.CreatedUnix ctx.Locale}} 9 + {{$createdStr:= DateUtils.TimeSince .Issue.CreatedUnix}} 10 10 <div class="issue-content-left comment-list prevent-before-timeline"> 11 11 <div class="ui timeline"> 12 12 <div id="{{.Issue.HashTag}}" class="timeline-item comment first">
+6 -6
templates/repo/issue/view_content/comments.tmpl
··· 1 1 {{template "base/alert"}} 2 2 {{range .Issue.Comments}} 3 3 {{if call $.ShouldShowCommentType .Type}} 4 - {{$createdStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} 4 + {{$createdStr:= DateUtils.TimeSince .CreatedUnix}} 5 5 6 6 <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 7 7 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 8 = MILESTONE_CHANGE, ··· 137 137 {{else if eq .RefAction 2}} 138 138 {{$refTr = "repo.issues.ref_reopening_from"}} 139 139 {{end}} 140 - {{$createdStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} 140 + {{$createdStr:= DateUtils.TimeSince .CreatedUnix}} 141 141 <div class="timeline-item event" id="{{.HashTag}}"> 142 142 <span class="badge">{{svg "octicon-bookmark"}}</span> 143 143 {{template "shared/user/avatarlink" dict "user" .Poster}} ··· 300 300 {{template "shared/user/avatarlink" dict "user" .Poster}} 301 301 <span class="text grey muted-links"> 302 302 {{template "shared/user/authorlink" .Poster}} 303 - {{$dueDate := ctx.DateUtils.AbsoluteLong (.Content|ctx.DateUtils.ParseLegacy)}} 303 + {{$dueDate := DateUtils.AbsoluteLong (.Content|DateUtils.ParseLegacy)}} 304 304 {{ctx.Locale.Tr "repo.issues.due_date_added" $dueDate $createdStr}} 305 305 </span> 306 306 </div> ··· 312 312 {{template "shared/user/authorlink" .Poster}} 313 313 {{$parsedDeadline := StringUtils.Split .Content "|"}} 314 314 {{if eq (len $parsedDeadline) 2}} 315 - {{$to := ctx.DateUtils.AbsoluteLong ((index $parsedDeadline 0)|ctx.DateUtils.ParseLegacy)}} 316 - {{$from := ctx.DateUtils.AbsoluteLong ((index $parsedDeadline 1)|ctx.DateUtils.ParseLegacy)}} 315 + {{$to := DateUtils.AbsoluteLong ((index $parsedDeadline 0)|DateUtils.ParseLegacy)}} 316 + {{$from := DateUtils.AbsoluteLong ((index $parsedDeadline 1)|DateUtils.ParseLegacy)}} 317 317 {{ctx.Locale.Tr "repo.issues.due_date_modified" $to $from $createdStr}} 318 318 {{end}} 319 319 </span> ··· 324 324 {{template "shared/user/avatarlink" dict "user" .Poster}} 325 325 <span class="text grey muted-links"> 326 326 {{template "shared/user/authorlink" .Poster}} 327 - {{$dueDate := ctx.DateUtils.AbsoluteLong (.Content|ctx.DateUtils.ParseLegacy)}} 327 + {{$dueDate := DateUtils.AbsoluteLong (.Content|DateUtils.ParseLegacy)}} 328 328 {{ctx.Locale.Tr "repo.issues.due_date_remove" $dueDate $createdStr}} 329 329 </span> 330 330 </div>
+1 -1
templates/repo/issue/view_content/conversation.tmpl
··· 51 51 <div id="code-comments-{{(index .comments 0).ID}}" class="comment-code-cloud ui segment{{if $resolved}} tw-hidden{{end}}"> 52 52 <div class="ui comments tw-mb-0"> 53 53 {{range .comments}} 54 - {{$createdSubStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} 54 + {{$createdSubStr:= DateUtils.TimeSince .CreatedUnix}} 55 55 <div class="comment code-comment tw-pb-4" id="{{.HashTag}}"> 56 56 <div class="content"> 57 57 <div class="header comment-header">
+1 -1
templates/repo/issue/view_content/pull.tmpl
··· 202 202 {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash $prUnit.PullRequestsConfig.AllowFastForwardOnly}} 203 203 {{$hasPendingPullRequestMergeTip := ""}} 204 204 {{if .HasPendingPullRequestMerge}} 205 - {{$createdPRMergeStr := TimeSinceUnix .PendingPullRequestMerge.CreatedUnix ctx.Locale}} 205 + {{$createdPRMergeStr := DateUtils.TimeSince .PendingPullRequestMerge.CreatedUnix}} 206 206 {{$hasPendingPullRequestMergeTip = ctx.Locale.Tr "repo.pulls.auto_merge_has_pending_schedule" .PendingPullRequestMerge.Doer.Name $createdPRMergeStr}} 207 207 {{end}} 208 208 <div class="divider"></div>
+1 -1
templates/repo/issue/view_content/sidebar/due_deadline.tmpl
··· 9 9 <div class="tw-flex tw-justify-between tw-items-center"> 10 10 <div class="due-date {{if .Issue.IsOverdue}}text red{{end}}" {{if .Issue.IsOverdue}}data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date_overdue"}}"{{end}}> 11 11 {{svg "octicon-calendar" 16 "tw-mr-2"}} 12 - {{ctx.DateUtils.AbsoluteLong .Issue.DeadlineUnix}} 12 + {{DateUtils.AbsoluteLong .Issue.DeadlineUnix}} 13 13 </div> 14 14 <div> 15 15 {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}}
+2 -2
templates/repo/issue/view_title.tmpl
··· 60 60 {{$baseHref = HTMLFormat `<a href="%s">%s</a>` .BaseBranchLink $baseHref}} 61 61 {{end}} 62 62 {{if .Issue.PullRequest.HasMerged}} 63 - {{$mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix ctx.Locale}} 63 + {{$mergedStr:= DateUtils.TimeSince .Issue.PullRequest.MergedUnix}} 64 64 {{if .Issue.OriginalAuthor}} 65 65 {{.Issue.OriginalAuthor}} 66 66 <span class="pull-desc">{{ctx.Locale.TrN .NumCommits "repo.pulls.merged_title_desc_one" "repo.pulls.merged_title_desc_few" .NumCommits $headHref $baseHref $mergedStr}}</span> ··· 126 126 </span> 127 127 {{end}} 128 128 {{else}} 129 - {{$createdStr:= TimeSinceUnix .Issue.CreatedUnix ctx.Locale}} 129 + {{$createdStr:= DateUtils.TimeSince .Issue.CreatedUnix}} 130 130 <span class="time-desc"> 131 131 {{if .Issue.OriginalAuthor}} 132 132 {{ctx.Locale.Tr "repo.issues.opened_by_fake" $createdStr .Issue.OriginalAuthor}}
+7 -7
templates/repo/pulse.tmpl
··· 1 1 <h2 class="ui header activity-header"> 2 - <span>{{ctx.DateUtils.AbsoluteLong .DateFrom}} - {{ctx.DateUtils.AbsoluteLong .DateUntil}}</span> 2 + <span>{{DateUtils.AbsoluteLong .DateFrom}} - {{DateUtils.AbsoluteLong .DateUntil}}</span> 3 3 <!-- Period --> 4 4 <div class="ui floating dropdown jump filter"> 5 5 <div class="ui basic compact button"> ··· 135 135 {{.TagName}} 136 136 <a class="title" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{.Title | RenderEmoji $.Context | RenderCodeBlock}}</a> 137 137 {{end}} 138 - {{TimeSinceUnix .CreatedUnix ctx.Locale}} 138 + {{DateUtils.TimeSince .CreatedUnix}} 139 139 </p> 140 140 {{end}} 141 141 </div> ··· 154 154 <p class="desc"> 155 155 <span class="ui purple label">{{ctx.Locale.Tr "repo.activity.merged_prs_label"}}</span> 156 156 #{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{RenderRefIssueTitle $.Context .Issue.Title}}</a> 157 - {{TimeSinceUnix .MergedUnix ctx.Locale}} 157 + {{DateUtils.TimeSince .MergedUnix}} 158 158 </p> 159 159 {{end}} 160 160 </div> ··· 173 173 <p class="desc"> 174 174 <span class="ui green label">{{ctx.Locale.Tr "repo.activity.opened_prs_label"}}</span> 175 175 #{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{RenderRefIssueTitle $.Context .Issue.Title}}</a> 176 - {{TimeSinceUnix .Issue.CreatedUnix ctx.Locale}} 176 + {{DateUtils.TimeSince .Issue.CreatedUnix}} 177 177 </p> 178 178 {{end}} 179 179 </div> ··· 192 192 <p class="desc"> 193 193 <span class="ui red label">{{ctx.Locale.Tr "repo.activity.closed_issue_label"}}</span> 194 194 #{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{RenderRefIssueTitle $.Context .Title}}</a> 195 - {{TimeSinceUnix .ClosedUnix ctx.Locale}} 195 + {{DateUtils.TimeSince .ClosedUnix}} 196 196 </p> 197 197 {{end}} 198 198 </div> ··· 211 211 <p class="desc"> 212 212 <span class="ui green label">{{ctx.Locale.Tr "repo.activity.new_issue_label"}}</span> 213 213 #{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{RenderRefIssueTitle $.Context .Title}}</a> 214 - {{TimeSinceUnix .CreatedUnix ctx.Locale}} 214 + {{DateUtils.TimeSince .CreatedUnix}} 215 215 </p> 216 216 {{end}} 217 217 </div> ··· 232 232 {{else}} 233 233 <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{RenderRefIssueTitle $.Context .Title}}</a> 234 234 {{end}} 235 - {{TimeSinceUnix .UpdatedUnix ctx.Locale}} 235 + {{DateUtils.TimeSince .UpdatedUnix}} 236 236 </p> 237 237 {{end}} 238 238 </div>
+1 -1
templates/repo/release/list.tmpl
··· 51 51 {{ctx.Locale.Tr "repo.released_this"}} 52 52 </span> 53 53 {{if $release.CreatedUnix}} 54 - <span class="time">{{TimeSinceUnix $release.CreatedUnix ctx.Locale}}</span> 54 + <span class="time">{{DateUtils.TimeSince $release.CreatedUnix}}</span> 55 55 {{end}} 56 56 {{if and (not $release.IsDraft) ($.Permission.CanRead $.UnitTypeCode)}} 57 57 | <span class="ahead"><a href="{{$.RepoLink}}/compare/{{$release.TagName | PathEscapeSegments}}...{{$release.TargetBehind | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind}}</a> {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}}</span>
+1 -1
templates/repo/settings/deploy_keys.tmpl
··· 55 55 {{.Fingerprint}} 56 56 </div> 57 57 <div class="flex-item-body"> 58 - <p>{{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{ctx.DateUtils.AbsoluteShort .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}} - <span>{{ctx.Locale.Tr "settings.can_read_info"}}{{if not .IsReadOnly}} / {{ctx.Locale.Tr "settings.can_write_info"}} {{end}}</span></p> 58 + <p>{{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateUtils.AbsoluteShort .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}} - <span>{{ctx.Locale.Tr "settings.can_read_info"}}{{if not .IsReadOnly}} / {{ctx.Locale.Tr "settings.can_write_info"}} {{end}}</span></p> 59 59 </div> 60 60 </div> 61 61 <div class="flex-item-trailing">
+1 -1
templates/repo/settings/lfs.tmpl
··· 17 17 </a> 18 18 </td> 19 19 <td>{{ctx.Locale.TrSize .Size}}</td> 20 - <td>{{TimeSince .CreatedUnix.AsTime ctx.Locale}}</td> 20 + <td>{{DateUtils.TimeSince .CreatedUnix}}</td> 21 21 <td class="right aligned"> 22 22 <a class="ui primary button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a> 23 23 <button class="ui basic show-modal icon button red" data-modal="#delete-{{.Oid}}">
+1 -1
templates/repo/settings/lfs_file_find.tmpl
··· 32 32 {{ctx.Locale.Tr "repo.diff.commit"}} 33 33 <a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{.SHA}}">{{ShortSha .SHA}}</a> 34 34 </td> 35 - <td>{{TimeSince .When ctx.Locale}}</td> 35 + <td>{{DateUtils.TimeSince .When}}</td> 36 36 </tr> 37 37 {{else}} 38 38 <tr>
+1 -1
templates/repo/settings/lfs_locks.tmpl
··· 35 35 {{$lock.Owner.DisplayName}} 36 36 </a> 37 37 </td> 38 - <td>{{TimeSince .Created ctx.Locale}}</td> 38 + <td>{{DateUtils.TimeSince .Created}}</td> 39 39 <td class="right aligned"> 40 40 <form action="{{$.LFSFilesLink}}/locks/{{$lock.ID}}/unlock" method="post"> 41 41 {{$.CsrfTokenHtml}}
+2 -2
templates/repo/settings/options.tmpl
··· 154 154 <tr> 155 155 <td>{{.PullMirror.RemoteAddress}}</td> 156 156 <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td> 157 - <td>{{ctx.DateUtils.FullTime .PullMirror.UpdatedUnix}}</td> 157 + <td>{{DateUtils.FullTime .PullMirror.UpdatedUnix}}</td> 158 158 <td class="right aligned"> 159 159 <form method="post" class="tw-inline-block"> 160 160 {{.CsrfTokenHtml}} ··· 243 243 <tr> 244 244 <td class="tw-break-anywhere">{{.RemoteAddress}}</td> 245 245 <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}</td> 246 - <td>{{if .LastUpdateUnix}}{{ctx.DateUtils.FullTime .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</div>{{end}}</td> 246 + <td>{{if .LastUpdateUnix}}{{DateUtils.FullTime .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</div>{{end}}</td> 247 247 <td>{{if not (eq (len .GetPublicKey) 0)}}<a data-clipboard-text="{{.GetPublicKey}}">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.copy_public_key"}}</a>{{else}}{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.none_ssh"}}{{end}}</td> 248 248 <td class="right aligned"> 249 249 <button
+1 -1
templates/repo/settings/webhook/history.tmpl
··· 29 29 <a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a> 30 30 </div> 31 31 <span class="text grey"> 32 - {{TimeSince .Delivered.AsTime ctx.Locale}} 32 + {{DateUtils.TimeSince .Delivered}} 33 33 </span> 34 34 </div> 35 35 <div class="info tw-hidden" id="info-{{.ID}}">
+1 -1
templates/repo/tag/list.tmpl
··· 27 27 <div class="download tw-flex tw-items-center"> 28 28 {{if $.Permission.CanRead $.UnitTypeCode}} 29 29 {{if .CreatedUnix}} 30 - <span class="tw-mr-2">{{svg "octicon-clock" 16 "tw-mr-1"}}{{TimeSinceUnix .CreatedUnix ctx.Locale}}</span> 30 + <span class="tw-mr-2">{{svg "octicon-clock" 16 "tw-mr-1"}}{{DateUtils.TimeSince .CreatedUnix}}</span> 31 31 {{end}} 32 32 33 33 <a class="tw-mr-2 tw-font-mono muted" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "tw-mr-1"}}{{ShortSha .Sha1}}</a>
+1 -1
templates/repo/user_cards.tmpl
··· 20 20 {{else if .Location}} 21 21 {{svg "octicon-location"}} {{.Location}} 22 22 {{else}} 23 - {{svg "octicon-calendar"}} {{ctx.Locale.Tr "user.joined_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}} 23 + {{svg "octicon-calendar"}} {{ctx.Locale.Tr "user.joined_on" (DateUtils.AbsoluteShort .CreatedUnix)}} 24 24 {{end}} 25 25 </div> 26 26 </div>
+1 -1
templates/repo/view_file.tmpl
··· 18 18 {{if .LatestCommit}} 19 19 {{if .LatestCommit.Committer}} 20 20 <div class="text grey age"> 21 - {{TimeSince .LatestCommit.Committer.When ctx.Locale}} 21 + {{DateUtils.TimeSince .LatestCommit.Committer.When}} 22 22 </div> 23 23 {{end}} 24 24 {{end}}
+2 -2
templates/repo/view_list.tmpl
··· 8 8 </div> 9 9 </div> 10 10 </th> 11 - <th class="text grey right age">{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When ctx.Locale}}{{end}}{{end}}</th> 11 + <th class="text grey right age">{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}{{end}}</th> 12 12 </tr> 13 13 </thead> 14 14 <tbody> ··· 62 62 {{end}} 63 63 </span> 64 64 </td> 65 - <td class="text right age three wide">{{if $commit}}{{TimeSince $commit.Committer.When ctx.Locale}}{{end}}</td> 65 + <td class="text right age three wide">{{if $commit}}{{DateUtils.TimeSince $commit.Committer.When}}{{end}}</td> 66 66 </tr> 67 67 {{end}} 68 68 </tbody>
+1 -1
templates/repo/wiki/pages.tmpl
··· 19 19 <a href="{{$.RepoLink}}/wiki/{{.SubURL}}">{{.Name}}</a> 20 20 <a class="wiki-git-entry" href="{{$.RepoLink}}/wiki/{{.GitEntryName | PathEscape}}" data-tooltip-content="{{ctx.Locale.Tr "repo.wiki.original_git_entry_tooltip"}}">{{svg "octicon-chevron-right"}}</a> 21 21 </td> 22 - {{$timeSince := TimeSinceUnix .UpdatedUnix ctx.Locale}} 22 + {{$timeSince := DateUtils.TimeSince .UpdatedUnix}} 23 23 <td class="text right">{{ctx.Locale.Tr "repo.wiki.last_updated" $timeSince}}</td> 24 24 </tr> 25 25 {{end}}
+1 -1
templates/repo/wiki/revision.tmpl
··· 9 9 <a class="file-revisions-btn ui basic button" title="{{ctx.Locale.Tr "repo.wiki.back_to_wiki"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}"><span>{{.revision}}</span> {{svg "octicon-home"}}</a> 10 10 {{$title}} 11 11 <div class="ui sub header tw-break-anywhere"> 12 - {{$timeSince := TimeSince .Author.When ctx.Locale}} 12 + {{$timeSince := DateUtils.TimeSince .Author.When}} 13 13 {{ctx.Locale.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince}} 14 14 </div> 15 15 </div>
+1 -1
templates/repo/wiki/view.tmpl
··· 48 48 <a class="file-revisions-btn ui basic button" title="{{ctx.Locale.Tr "repo.wiki.file_revision"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_revision" ><span>{{.CommitCount}}</span> {{svg "octicon-history"}}</a> 49 49 {{$title}} 50 50 <div class="ui sub header"> 51 - {{$timeSince := TimeSince .Author.When ctx.Locale}} 51 + {{$timeSince := DateUtils.TimeSince .Author.When}} 52 52 {{ctx.Locale.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince}} 53 53 </div> 54 54 </div>
+2 -2
templates/shared/actions/runner_edit.tmpl
··· 13 13 </div> 14 14 <div class="field tw-inline-block tw-mr-4"> 15 15 <label>{{ctx.Locale.Tr "actions.runners.last_online"}}</label> 16 - <span>{{if .Runner.LastOnline}}{{TimeSinceUnix .Runner.LastOnline ctx.Locale}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</span> 16 + <span>{{if .Runner.LastOnline}}{{DateUtils.TimeSince .Runner.LastOnline}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</span> 17 17 </div> 18 18 <div class="field tw-inline-block tw-mr-4"> 19 19 <label>{{ctx.Locale.Tr "actions.runners.labels"}}</label> ··· 70 70 <strong><a href="{{.GetCommitLink}}" target="_blank">{{ShortSha .CommitSHA}}</a></strong> 71 71 </td> 72 72 <td>{{if .IsStopped}} 73 - <span>{{TimeSinceUnix .Stopped ctx.Locale}}</span> 73 + <span>{{DateUtils.TimeSince .Stopped}}</span> 74 74 {{else}}-{{end}}</td> 75 75 </tr> 76 76 {{end}}
+1 -1
templates/shared/actions/runner_list.tmpl
··· 73 73 <td class="tw-flex tw-flex-wrap tw-gap-2 runner-tags"> 74 74 {{range .AgentLabels}}<span class="ui label">{{.}}</span>{{end}} 75 75 </td> 76 - <td>{{if .LastOnline}}{{TimeSinceUnix .LastOnline ctx.Locale}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</td> 76 + <td>{{if .LastOnline}}{{DateUtils.TimeSince .LastOnline}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</td> 77 77 <td class="runner-ops"> 78 78 {{if .Editable $.RunnerOwnerID $.RunnerRepoID}} 79 79 <a href="{{$.Link}}/{{.ID}}">{{svg "octicon-pencil"}}</a>
+2 -2
templates/shared/issuelist.tmpl
··· 60 60 #{{.Index}} 61 61 {{end}} 62 62 </a> 63 - {{$timeStr := TimeSinceUnix .GetLastEventTimestamp ctx.Locale}} 63 + {{$timeStr := DateUtils.TimeSince .GetLastEventTimestamp}} 64 64 {{if .OriginalAuthor}} 65 65 {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor}} 66 66 {{else if gt .Poster.ID 0}} ··· 117 117 <span class="due-date flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date"}}"> 118 118 <span{{if .IsOverdue}} class="text red"{{end}}> 119 119 {{svg "octicon-calendar" 14}} 120 - {{ctx.DateUtils.AbsoluteShort .DeadlineUnix}} 120 + {{DateUtils.AbsoluteShort .DeadlineUnix}} 121 121 </span> 122 122 </span> 123 123 {{end}}
+1 -1
templates/shared/searchbottom.tmpl
··· 7 7 </div> 8 8 <div class="tw-mr-4"> 9 9 {{if not .result.UpdatedUnix.IsZero}} 10 - <span class="ui grey text">{{ctx.Locale.Tr "explore.code_last_indexed_at" (TimeSinceUnix .result.UpdatedUnix ctx.Locale)}}</span> 10 + <span class="ui grey text">{{ctx.Locale.Tr "explore.code_last_indexed_at" (DateUtils.TimeSince .result.UpdatedUnix)}}</span> 11 11 {{end}} 12 12 </div> 13 13 </div>
+1 -1
templates/shared/secrets/add_list.tmpl
··· 28 28 </div> 29 29 <div class="flex-item-trailing"> 30 30 <span class="color-text-light-2"> 31 - {{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}} 31 + {{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}} 32 32 </span> 33 33 <button class="ui btn interact-bg link-action tw-p-2" 34 34 data-url="{{$.Link}}/delete?id={{.ID}}"
+1 -1
templates/shared/user/profile_big_avatar.tmpl
··· 73 73 </li> 74 74 {{end}} 75 75 {{end}} 76 - <li>{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (ctx.DateUtils.AbsoluteShort .ContextUser.CreatedUnix)}}</span></li> 76 + <li>{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (DateUtils.AbsoluteShort .ContextUser.CreatedUnix)}}</span></li> 77 77 {{if and .Orgs .HasOrgsVisible}} 78 78 <li> 79 79 <ul class="user-orgs">
+1 -1
templates/shared/variables/variable_list.tmpl
··· 30 30 </div> 31 31 <div class="flex-item-trailing"> 32 32 <span class="color-text-light-2"> 33 - {{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}} 33 + {{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}} 34 34 </span> 35 35 <button class="btn interact-bg tw-p-2 show-modal" 36 36 data-tooltip-content="{{ctx.Locale.Tr "actions.variables.edit"}}"
+1 -1
templates/user/dashboard/feeds.tmpl
··· 78 78 {{$reviewer := index .GetIssueInfos 1}} 79 79 {{ctx.Locale.Tr "action.review_dismissed" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx) $reviewer}} 80 80 {{end}} 81 - {{TimeSince .GetCreate ctx.Locale}} 81 + {{DateUtils.TimeSince .GetCreate}} 82 82 </div> 83 83 {{if .GetOpType.InActions "commit_repo" "mirror_sync_push"}} 84 84 {{$push := ActionContent2Commits .}}
+3 -3
templates/user/dashboard/milestones.tmpl
··· 104 104 {{if .UpdatedUnix}} 105 105 <div class="flex-text-block"> 106 106 {{svg "octicon-clock"}} 107 - {{ctx.Locale.Tr "repo.milestones.update_ago" (TimeSinceUnix .UpdatedUnix ctx.Locale)}} 107 + {{ctx.Locale.Tr "repo.milestones.update_ago" (DateUtils.TimeSince .UpdatedUnix)}} 108 108 </div> 109 109 {{end}} 110 110 <div class="flex-text-block"> 111 111 {{if .IsClosed}} 112 - {{$closedDate:= TimeSinceUnix .ClosedDateUnix ctx.Locale}} 112 + {{$closedDate:= DateUtils.TimeSince .ClosedDateUnix}} 113 113 {{svg "octicon-clock" 14}} 114 114 {{ctx.Locale.Tr "repo.milestones.closed" $closedDate}} 115 115 {{else}} 116 116 {{if .DeadlineString}} 117 117 <span{{if .IsOverdue}} class="text red"{{end}}> 118 118 {{svg "octicon-calendar" 14}} 119 - {{ctx.DateUtils.AbsoluteShort (.DeadlineString|ctx.DateUtils.ParseLegacy)}} 119 + {{DateUtils.AbsoluteShort (.DeadlineString|DateUtils.ParseLegacy)}} 120 120 </span> 121 121 {{else}} 122 122 {{svg "octicon-calendar" 14}}
+2 -2
templates/user/notification/notification_div.tmpl
··· 67 67 </a> 68 68 <div class="notifications-updated tw-items-center tw-mr-2"> 69 69 {{if .Issue}} 70 - {{TimeSinceUnix .Issue.UpdatedUnix ctx.Locale}} 70 + {{DateUtils.TimeSince .Issue.UpdatedUnix}} 71 71 {{else}} 72 - {{TimeSinceUnix .UpdatedUnix ctx.Locale}} 72 + {{DateUtils.TimeSince .UpdatedUnix}} 73 73 {{end}} 74 74 </div> 75 75 <div class="notifications-buttons tw-items-center tw-justify-end tw-gap-1 tw-px-1">
+1 -1
templates/user/settings/applications.tmpl
··· 36 36 </ul> 37 37 </details> 38 38 <div class="flex-item-body"> 39 - <p>{{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{ctx.DateUtils.AbsoluteShort .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</p> 39 + <p>{{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateUtils.AbsoluteShort .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</p> 40 40 </div> 41 41 </div> 42 42 <div class="flex-item-trailing">
+1 -1
templates/user/settings/grants_oauth2.tmpl
··· 14 14 <div class="flex-item-main"> 15 15 <div class="flex-item-title">{{.Application.Name}}</div> 16 16 <div class="flex-item-body"> 17 - <p>{{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}}</p> 17 + <p>{{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}}</p> 18 18 </div> 19 19 </div> 20 20 <div class="flex-item-trailing">
+2 -2
templates/user/settings/keys_gpg.tmpl
··· 63 63 <b>{{ctx.Locale.Tr "settings.subkeys"}}:</b> {{range .SubsKey}} {{.PaddedKeyID}} {{end}} 64 64 </div> 65 65 <div class="flex-item-body"> 66 - <p>{{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .AddedUnix)}}</p> 66 + <p>{{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .AddedUnix)}}</p> 67 67 - 68 - <p>{{if not .ExpiredUnix.IsZero}}{{ctx.Locale.Tr "settings.valid_until_date" (ctx.DateUtils.AbsoluteShort .ExpiredUnix)}}{{else}}{{ctx.Locale.Tr "settings.valid_forever"}}{{end}}</p> 68 + <p>{{if not .ExpiredUnix.IsZero}}{{ctx.Locale.Tr "settings.valid_until_date" (DateUtils.AbsoluteShort .ExpiredUnix)}}{{else}}{{ctx.Locale.Tr "settings.valid_forever"}}{{end}}</p> 69 69 </div> 70 70 </div> 71 71 <div class="flex-item-trailing">
+1 -1
templates/user/settings/keys_principal.tmpl
··· 22 22 <div class="flex-item-main"> 23 23 <div class="flex-item-title">{{.Name}}</div> 24 24 <div class="flex-item-body"> 25 - <p>{{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}} — {{svg "octicon-info" 16}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{ctx.DateUtils.AbsoluteShort .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</p> 25 + <p>{{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}} — {{svg "octicon-info" 16}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateUtils.AbsoluteShort .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</p> 26 26 </div> 27 27 </div> 28 28 <div class="flex-item-trailing">
+1 -1
templates/user/settings/keys_ssh.tmpl
··· 53 53 {{.Fingerprint}} 54 54 </div> 55 55 <div class="flex-item-body"> 56 - <p>{{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{ctx.DateUtils.AbsoluteShort .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</p> 56 + <p>{{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateUtils.AbsoluteShort .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</p> 57 57 </div> 58 58 </div> 59 59 <div class="flex-item-trailing">
+1 -1
templates/user/settings/security/webauthn.tmpl
··· 12 12 <div class="flex-item-main"> 13 13 <div class="flex-item-title">{{.Name}}</div> 14 14 <div class="flex-item-body"> 15 - <p>{{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}}</p> 15 + <p>{{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}}</p> 16 16 </div> 17 17 </div> 18 18 <div class="flex-item-trailing">