Skip to content

Commit 70bb498

Browse files
Allow using localized absolute date times within phrases with place holders and localize issue due date events (#24275)
This refactors the `shared/datetime/short|long|full` templates into a template helper function, which allows us to render absolute date times within translatable phrases. - Follows #23988 - The first attempt was in #24055 - This should help #22664 Changes: 1. Added the `DateTime` template helper that replaces the `shared/datetime/short|long|full` templates 2. Used find-and-replace with varying regexes to replace the templates from step 1 (for example, `\{\{template "shared/datetime/(\S+) \(dict "Datetime" ([^"]+) "Fallback" ([^\)]+\)?) ?\)?\}\}` -> `{{DateTime "$1 $2 $3}}`) 3. Used the new `DateTime` helper in the issue due date timestamp rendering # Before ![image](https://user-images.githubusercontent.com/20454870/233791256-b454c455-aca0-4b76-b300-7866c7bd529e.png) # After ![image](https://user-images.githubusercontent.com/20454870/233790809-c4913355-2822-4657-bb29-2298deb6d4b3.png) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent cbe2e99 commit 70bb498

33 files changed

+64
-39
lines changed

modules/templates/helper.go

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ func NewFuncMap() []template.FuncMap {
139139
"CountFmt": base.FormatNumberSI,
140140
"TimeSince": timeutil.TimeSince,
141141
"TimeSinceUnix": timeutil.TimeSinceUnix,
142+
"DateTime": timeutil.DateTime,
142143
"Sec2Time": util.SecToTime,
143144
"DateFmtLong": func(t time.Time) string {
144145
return t.Format(time.RFC3339)

modules/timeutil/datetime.go

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
)
11+
12+
// DateTime renders an absolute time HTML given a time as a string
13+
func DateTime(format, datetime, fallback string) template.HTML {
14+
datetimeEscaped := html.EscapeString(datetime)
15+
fallbackEscaped := html.EscapeString(fallback)
16+
switch format {
17+
case "short":
18+
return template.HTML(fmt.Sprintf(`<relative-time format="datetime" year="numeric" month="short" day="numeric" weekday="" datetime="%s">%s</relative-time>`, datetimeEscaped, fallbackEscaped))
19+
case "long":
20+
return template.HTML(fmt.Sprintf(`<relative-time format="datetime" year="numeric" month="long" day="numeric" weekday="" datetime="%s">%s</relative-time>`, datetimeEscaped, fallbackEscaped))
21+
case "full":
22+
return template.HTML(fmt.Sprintf(`<relative-time format="datetime" weekday="" year="numeric" month="short" day="numeric" hour="numeric" minute="numeric" second="numeric" datetime="%s">%s</relative-time>`, datetimeEscaped, fallbackEscaped))
23+
}
24+
return template.HTML("error in DateTime")
25+
}

templates/admin/auth/list.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{.Name}}</a></td>
2727
<td>{{.TypeName}}</td>
2828
<td>{{if .IsActive}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td>
29-
<td>{{template "shared/datetime/short" (dict "Datetime" .UpdatedUnix.FormatLong "Fallback" .UpdatedUnix.FormatShort)}}</td>
30-
<td>{{template "shared/datetime/short" (dict "Datetime" .CreatedUnix.FormatLong "Fallback" .CreatedUnix.FormatShort)}}</td>
29+
<td>{{DateTime "short" .UpdatedUnix.FormatLong .UpdatedUnix.FormatShort}}</td>
30+
<td>{{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}}</td>
3131
<td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{svg "octicon-pencil"}}</a></td>
3232
</tr>
3333
{{end}}

templates/admin/cron.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<td><button type="submit" class="ui green button" name="op" value="{{.Name}}" title="{{$.locale.Tr "admin.dashboard.operation_run"}}">{{svg "octicon-triangle-right"}}</button></td>
2222
<td>{{$.locale.Tr (printf "admin.dashboard.%s" .Name)}}</td>
2323
<td>{{.Spec}}</td>
24-
<td>{{template "shared/datetime/full" (dict "Datetime" (DateFmtLong .Next) "Fallback" (DateFmtLong .Next) )}}</td>
25-
<td>{{if gt .Prev.Year 1}}{{template "shared/datetime/full" (dict "Datetime" (DateFmtLong .Prev) "Fallback" (DateFmtLong .Prev) )}}{{else}}N/A{{end}}</td>
24+
<td>{{DateTime "full" (DateFmtLong .Next) (DateFmtLong .Next)}}</td>
25+
<td>{{if gt .Prev.Year 1}}{{DateTime "full" (DateFmtLong .Prev) (DateFmtLong .Prev)}}{{else}}N/A{{end}}</td>
2626
<td>{{.ExecTimes}}</td>
2727
<td {{if ne .Status ""}}data-tooltip-content="{{.FormatLastMessage $.locale}}"{{end}} >{{if eq .Status ""}}—{{else if eq .Status "finished"}}{{svg "octicon-check" 16}}{{else}}{{svg "octicon-x" 16}}{{end}}</td>
2828
</tr>

templates/admin/notice.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<td>{{.ID}}</td>
2727
<td>{{$.locale.Tr .TrStr}}</td>
2828
<td class="view-detail"><span class="notice-description text truncate">{{.Description}}</span></td>
29-
<td>{{template "shared/datetime/short" (dict "Datetime" .CreatedUnix.FormatLong "Fallback" .CreatedUnix.FormatShort)}}</td>
29+
<td>{{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}}</td>
3030
<td><a href="#">{{svg "octicon-note" 16 "view-detail"}}</a></td>
3131
</tr>
3232
{{end}}

templates/admin/org/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<td>{{.NumTeams}}</td>
4242
<td>{{.NumMembers}}</td>
4343
<td>{{.NumRepos}}</td>
44-
<td>{{template "shared/datetime/short" (dict "Datetime" .CreatedUnix.FormatLong "Fallback" .CreatedUnix.FormatShort)}}</td>
44+
<td>{{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}}</td>
4545
<td><a href="{{.OrganisationLink}}/settings">{{svg "octicon-pencil"}}</a></td>
4646
</tr>
4747
{{end}}

templates/admin/packages/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
{{end}}
6666
</td>
6767
<td>{{FileSize .CalculateBlobSize}}</td>
68-
<td>{{template "shared/datetime/short" (dict "Datetime" .Version.CreatedUnix.FormatLong "Fallback" .Version.CreatedUnix.FormatShort)}}</td>
68+
<td>{{DateTime "short" .Version.CreatedUnix.FormatLong .Version.CreatedUnix.FormatShort}}</td>
6969
<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>
7070
</tr>
7171
{{end}}

templates/admin/queue.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@
155155
{{range .Queue.Workers}}
156156
<tr>
157157
<td>{{.Workers}}{{if .IsFlusher}}<span title="{{$.locale.Tr "admin.monitor.queue.flush"}}">{{svg "octicon-sync"}}</span>{{end}}</td>
158-
<td>{{template "shared/datetime/full" (dict "Datetime" (DateFmtLong .Start) "Fallback" (DateFmtLong .Start) )}}</td>
159-
<td>{{if .HasTimeout}}{{template "shared/datetime/full" (dict "Datetime" (DateFmtLong .Timeout) "Fallback" (DateFmtLong .Timeout) )}}{{else}}-{{end}}</td>
158+
<td>{{DateTime "full" (DateFmtLong .Start) (DateFmtLong .Start)}}</td>
159+
<td>{{if .HasTimeout}}{{DateTime "full" (DateFmtLong .Timeout) (DateFmtLong .Timeout)}}{{else}}-{{end}}</td>
160160
<td>
161161
<a class="delete-button" href="" data-url="{{$.Link}}/cancel/{{.PID}}" data-id="{{.PID}}" data-name="{{.Workers}}" title="{{$.locale.Tr "remove"}}">{{svg "octicon-trash"}}</a>
162162
</td>

templates/admin/repo/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<td>{{.NumForks}}</td>
8181
<td>{{.NumIssues}}</td>
8282
<td>{{FileSize .Size}}</td>
83-
<td>{{template "shared/datetime/short" (dict "Datetime" .CreatedUnix.FormatLong "Fallback" .CreatedUnix.FormatShort)}}</td>
83+
<td>{{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}}</td>
8484
<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>
8585
</tr>
8686
{{end}}

templates/admin/user/list.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@
9191
<td>{{if .IsRestricted}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td>
9292
<td>{{if index $.UsersTwoFaStatus .ID}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td>
9393
<td>{{.NumRepos}}</td>
94-
<td>{{template "shared/datetime/short" (dict "Datetime" .CreatedUnix.FormatLong "Fallback" .CreatedUnix.FormatShort)}}</td>
94+
<td>{{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}}</td>
9595
{{if .LastLoginUnix}}
96-
<td>{{template "shared/datetime/short" (dict "Datetime" .LastLoginUnix.FormatLong "Fallback" .LastLoginUnix.FormatShort)}}</td>
96+
<td>{{DateTime "short" .LastLoginUnix.FormatLong .LastLoginUnix.FormatShort}}</td>
9797
{{else}}
9898
<td><span>{{$.locale.Tr "admin.users.never_login"}}</span></td>
9999
{{end}}

templates/explore/organizations.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{{svg "octicon-link"}}
2424
<a href="{{.Website}}" rel="nofollow">{{.Website}}</a>
2525
{{end}}
26-
{{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{template "shared/datetime/short" (dict "Datetime" .CreatedUnix.FormatLong "Fallback" .CreatedUnix.FormatShort)}}
26+
{{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}}
2727
</div>
2828
</div>
2929
</div>

templates/explore/users.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{{svg "octicon-mail"}}
1919
<a href="mailto:{{.Email}}" rel="nofollow">{{.Email}}</a>
2020
{{end}}
21-
{{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{template "shared/datetime/short" (dict "Datetime" .CreatedUnix.FormatLong "Fallback" .CreatedUnix.FormatShort)}}
21+
{{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}}
2222
</div>
2323
</div>
2424
</div>

templates/package/shared/cleanup_rules/preview.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<td><a href="{{.FullWebLink}}">{{.Version.Version}}</a></td>
2323
<td><a href="{{.Creator.HomeLink}}">{{.Creator.Name}}</a></td>
2424
<td>{{FileSize .CalculateBlobSize}}</td>
25-
<td>{{template "shared/datetime/short" (dict "Datetime" .Version.CreatedUnix.FormatLong "Fallback" .Version.CreatedUnix.FormatShort)}}</td>
25+
<td>{{DateTime "short" .Version.CreatedUnix.FormatLong .Version.CreatedUnix.FormatShort}}</td>
2626
</tr>
2727
{{else}}
2828
<tr>

templates/package/view.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
{{range .LatestVersions}}
8787
<div class="item gt-df">
8888
<a class="gt-f1" href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .LowerVersion}}">{{.Version}}</a>
89-
<span class="text small">{{template "shared/datetime/short" (dict "Datetime" (.CreatedUnix.FormatDate) "Fallback" (.CreatedUnix.FormatDate))}}</span>
89+
<span class="text small">{{DateTime "short" (.CreatedUnix.FormatDate) (.CreatedUnix.FormatDate)}}</span>
9090
</div>
9191
{{end}}
9292
</div>

templates/repo/activity.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content repository commits">
33
{{template "repo/header" .}}
44
<div class="ui container">
5-
<h2 class="ui header">{{template "shared/datetime/long" (dict "Datetime" .DateFrom "Fallback" .DateFrom)}} - {{template "shared/datetime/long" (dict "Datetime" .DateUntil "Fallback" .DateUntil)}}
5+
<h2 class="ui header">{{DateTime "long" .DateFrom .DateFrom}} - {{DateTime "long" .DateUntil .DateUntil}}
66
<div class="ui right">
77
<!-- Period -->
88
<div class="ui floating dropdown jump filter">

templates/repo/issue/milestone_issues.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
{{else}}
3636
{{svg "octicon-calendar"}}
3737
{{if .Milestone.DeadlineString}}
38-
<span {{if .IsOverdue}}class="overdue"{{end}}>{{template "shared/datetime/short" (dict "Datetime" .Milestone.DeadlineString "Fallback" .Milestone.DeadlineString)}}</span>
38+
<span {{if .IsOverdue}}class="overdue"{{end}}>{{DateTime "short" .Milestone.DeadlineString .Milestone.DeadlineString}}</span>
3939
{{else}}
4040
{{$.locale.Tr "repo.milestones.no_due_date"}}
4141
{{end}}

templates/repo/issue/milestones.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
{{else}}
7878
{{svg "octicon-calendar"}}
7979
{{if .DeadlineString}}
80-
<span {{if .IsOverdue}}class="overdue"{{end}}>{{template "shared/datetime/short" (dict "Datetime" .DeadlineString "Fallback" .DeadlineString)}}</span>
80+
<span {{if .IsOverdue}}class="overdue"{{end}}>{{DateTime "short" .DeadlineString .DeadlineString}}</span>
8181
{{else}}
8282
{{$.locale.Tr "repo.milestones.no_due_date"}}
8383
{{end}}

templates/repo/issue/view_content/comments.tmpl

+5-3
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@
295295
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
296296
<span class="text grey muted-links">
297297
{{template "shared/user/authorlink" .Poster}}
298-
{{$.locale.Tr "repo.issues.due_date_added" .Content $createdStr | Safe}}
298+
{{$.locale.Tr "repo.issues.due_date_added" (DateTime "long" .Content .Content) $createdStr | Safe}}
299299
</span>
300300
</div>
301301
{{else if eq .Type 17}}
@@ -305,7 +305,9 @@
305305
<span class="text grey muted-links">
306306
{{template "shared/user/authorlink" .Poster}}
307307
{{$parsedDeadline := .Content | ParseDeadline}}
308-
{{$.locale.Tr "repo.issues.due_date_modified" (index $parsedDeadline 0) (index $parsedDeadline 1) $createdStr | Safe}}
308+
{{$from := DateTime "long" (index $parsedDeadline 1) (index $parsedDeadline 1)}}
309+
{{$to := DateTime "long" (index $parsedDeadline 0) (index $parsedDeadline 0)}}
310+
{{$.locale.Tr "repo.issues.due_date_modified" $to $from $createdStr | Safe}}
309311
</span>
310312
</div>
311313
{{else if eq .Type 18}}
@@ -314,7 +316,7 @@
314316
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
315317
<span class="text grey muted-links">
316318
{{template "shared/user/authorlink" .Poster}}
317-
{{$.locale.Tr "repo.issues.due_date_remove" .Content $createdStr | Safe}}
319+
{{$.locale.Tr "repo.issues.due_date_remove" (DateTime "long" .Content .Content) $createdStr | Safe}}
318320
</span>
319321
</div>
320322
{{else if eq .Type 19}}

templates/repo/issue/view_content/sidebar.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@
385385
<div class="gt-df gt-sb gt-ac">
386386
<div class="due-date {{if .Issue.IsOverdue}}text red{{end}}" {{if .Issue.IsOverdue}}data-tooltip-content="{{.locale.Tr "repo.issues.due_date_overdue"}}"{{end}}>
387387
{{svg "octicon-calendar" 16 "gt-mr-3"}}
388-
{{template "shared/datetime/long" (dict "Datetime" .Issue.DeadlineUnix.FormatDate "Fallback" .Issue.DeadlineUnix.FormatDate)}}
388+
{{DateTime "long" .Issue.DeadlineUnix.FormatDate .Issue.DeadlineUnix.FormatDate}}
389389
</div>
390390
<div>
391391
{{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}}

templates/repo/settings/deploy_keys.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
{{.Fingerprint}}
6161
</div>
6262
<div class="activity meta">
63-
<i>{{$.locale.Tr "settings.add_on"}} <span>{{template "shared/datetime/short" (dict "Datetime" .CreatedUnix.FormatLong "Fallback" .CreatedUnix.FormatShort)}}</span> — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{template "shared/datetime/short" (dict "Datetime" .UpdatedUnix.FormatLong "Fallback" .UpdatedUnix.FormatShort)}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}} - <span>{{$.locale.Tr "settings.can_read_info"}}{{if not .IsReadOnly}} / {{$.locale.Tr "settings.can_write_info"}} {{end}}</span></i>
63+
<i>{{$.locale.Tr "settings.add_on"}} <span>{{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}}</span> — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix.FormatLong .UpdatedUnix.FormatShort}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}} - <span>{{$.locale.Tr "settings.can_read_info"}}{{if not .IsReadOnly}} / {{$.locale.Tr "settings.can_write_info"}} {{end}}</span></i>
6464
</div>
6565
</div>
6666
</div>

templates/repo/settings/options.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<tr>
9090
<td>{{(MirrorRemoteAddress $.Context .Repository .Mirror.GetRemoteName false).Address}}</td>
9191
<td>{{$.locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td>
92-
<td>{{template "shared/datetime/full" (dict "Datetime" .Mirror.UpdatedUnix.FormatLong "Fallback" .Mirror.UpdatedUnix.AsTime)}}</td>
92+
<td>{{DateTime "full" .Mirror.UpdatedUnix.FormatLong .Mirror.UpdatedUnix.AsTime}}</td>
9393
<td class="right aligned">
9494
<form method="post" style="display: inline-block">
9595
{{.CsrfTokenHtml}}
@@ -167,7 +167,7 @@
167167
{{$address := MirrorRemoteAddress $.Context $.Repository .GetRemoteName true}}
168168
<td>{{$address.Address}}</td>
169169
<td>{{$.locale.Tr "repo.settings.mirror_settings.direction.push"}}</td>
170-
<td>{{if .LastUpdateUnix}}{{template "shared/datetime/full" (dict "Datetime" .LastUpdateUnix.FormatLong "Fallback" .LastUpdateUnix.AsTime)}}{{else}}{{$.locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{$.locale.Tr "error"}}</div>{{end}}</td>
170+
<td>{{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix.FormatLong .LastUpdateUnix.AsTime}}{{else}}{{$.locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{$.locale.Tr "error"}}</div>{{end}}</td>
171171
<td class="right aligned">
172172
<form method="post" style="display: inline-block">
173173
{{$.CsrfTokenHtml}}

templates/repo/user_cards.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{{else if .Location}}
1919
{{svg "octicon-location"}} {{.Location}}
2020
{{else}}
21-
{{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{template "shared/datetime/short" (dict "Datetime" .CreatedUnix.FormatLong "Fallback" .CreatedUnix.FormatShort)}}
21+
{{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}}
2222
{{end}}
2323
</div>
2424
</li>

templates/shared/datetime/full.tmpl

-1
This file was deleted.

templates/shared/datetime/long.tmpl

-1
This file was deleted.

templates/shared/datetime/short.tmpl

-1
This file was deleted.

templates/shared/issuelist.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<span class="due-date" data-tooltip-content="{{$.locale.Tr "repo.issues.due_date"}}">
107107
<span{{if .IsOverdue}} class="overdue"{{end}}>
108108
{{svg "octicon-calendar" 14 "gt-mr-2"}}
109-
{{template "shared/datetime/short" (dict "Datetime" .DeadlineUnix.FormatDate "Fallback" .DeadlineUnix.FormatShort)}}
109+
{{DateTime "short" .DeadlineUnix.FormatDate .DeadlineUnix.FormatShort}}
110110
</span>
111111
</span>
112112
{{end}}

templates/user/dashboard/milestones.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
{{else}}
9898
{{svg "octicon-calendar"}}
9999
{{if .DeadlineString}}
100-
<span {{if .IsOverdue}}class="overdue"{{end}}>{{template "shared/datetime/short" (dict "Datetime" .DeadlineString "Fallback" .DeadlineString)}}</span>
100+
<span {{if .IsOverdue}}class="overdue"{{end}}>{{DateTime "short" .DeadlineString .DeadlineString}}</span>
101101
{{else}}
102102
{{$.locale.Tr "repo.milestones.no_due_date"}}
103103
{{end}}

templates/user/profile.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
</li>
7474
{{end}}
7575
{{end}}
76-
<li>{{svg "octicon-clock"}} {{.locale.Tr "user.join_on"}} {{template "shared/datetime/short" (dict "Datetime" .ContextUser.CreatedUnix.FormatLong "Fallback" .ContextUser.CreatedUnix.FormatShort)}}</li>
76+
<li>{{svg "octicon-clock"}} {{.locale.Tr "user.join_on"}} {{DateTime "short" .ContextUser.CreatedUnix.FormatLong .ContextUser.CreatedUnix.FormatShort}}</li>
7777
{{if and .Orgs .HasOrgsVisible}}
7878
<li>
7979
<ul class="user-orgs">

templates/user/settings/applications.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</ul>
2828
</details>
2929
<div class="activity meta">
30-
<i>{{$.locale.Tr "settings.add_on"}} <span>{{template "shared/datetime/short" (dict "Datetime" .CreatedUnix.FormatLong "Fallback" .CreatedUnix.FormatShort)}}</span> — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{template "shared/datetime/short" (dict "Datetime" .UpdatedUnix.FormatLong "Fallback" .UpdatedUnix.FormatShort)}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}</i>
30+
<i>{{$.locale.Tr "settings.add_on"}} <span>{{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}}</span> — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix.FormatLong .UpdatedUnix.FormatShort}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}</i>
3131
</div>
3232
</div>
3333
</div>

templates/user/settings/grants_oauth2.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<div class="content">
2121
<strong>{{$grant.Application.Name}}</strong>
2222
<div class="activity meta">
23-
<i>{{$.locale.Tr "settings.add_on"}} <span>{{template "shared/datetime/short" (dict "Datetime" $grant.CreatedUnix.FormatLong "Fallback" $grant.CreatedUnix.FormatShort)}}</span></i>
23+
<i>{{$.locale.Tr "settings.add_on"}} <span>{{DateTime "short" $grant.CreatedUnix.FormatLong $grant.CreatedUnix.FormatShort}}</span></i>
2424
</div>
2525
</div>
2626
</div>

0 commit comments

Comments
 (0)