aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/templates/helper.go1
-rw-r--r--modules/templates/util_date.go34
-rw-r--r--routers/web/repo/activity.go4
-rw-r--r--services/context/context.go1
-rw-r--r--templates/admin/auth/list.tmpl4
-rw-r--r--templates/admin/cron.tmpl4
-rw-r--r--templates/admin/notice.tmpl2
-rw-r--r--templates/admin/org/list.tmpl2
-rw-r--r--templates/admin/packages/list.tmpl2
-rw-r--r--templates/admin/repo/list.tmpl4
-rw-r--r--templates/admin/user/list.tmpl4
-rw-r--r--templates/explore/user_list.tmpl2
-rw-r--r--templates/package/shared/cleanup_rules/preview.tmpl2
-rw-r--r--templates/package/view.tmpl2
-rw-r--r--templates/repo/diff/compare.tmpl2
-rw-r--r--templates/repo/empty.tmpl2
-rw-r--r--templates/repo/graph/commits.tmpl2
-rw-r--r--templates/repo/home.tmpl2
-rw-r--r--templates/repo/issue/view_content/sidebar.tmpl2
-rw-r--r--templates/repo/pulse.tmpl2
-rw-r--r--templates/repo/settings/deploy_keys.tmpl2
-rw-r--r--templates/repo/settings/options.tmpl4
-rw-r--r--templates/repo/user_cards.tmpl2
-rw-r--r--templates/shared/issuelist.tmpl2
-rw-r--r--templates/shared/secrets/add_list.tmpl2
-rw-r--r--templates/shared/user/profile_big_avatar.tmpl2
-rw-r--r--templates/shared/variables/variable_list.tmpl2
-rw-r--r--templates/user/settings/applications.tmpl2
-rw-r--r--templates/user/settings/grants_oauth2.tmpl2
-rw-r--r--templates/user/settings/keys_gpg.tmpl4
-rw-r--r--templates/user/settings/keys_principal.tmpl2
-rw-r--r--templates/user/settings/keys_ssh.tmpl2
-rw-r--r--templates/user/settings/security/webauthn.tmpl2
33 files changed, 73 insertions, 37 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 5f73e6b278..5038e8a132 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -54,6 +54,7 @@ func NewFuncMap() template.FuncMap {
"StringUtils": NewStringUtils,
"SliceUtils": NewSliceUtils,
"JsonUtils": NewJsonUtils,
+ "DateUtils": NewDateUtils, // TODO: to be replaced by DateUtils
// -----------------------------------------------------------------
// svg / avatar / icon / color
diff --git a/modules/templates/util_date.go b/modules/templates/util_date.go
new file mode 100644
index 0000000000..ec48a7e4be
--- /dev/null
+++ b/modules/templates/util_date.go
@@ -0,0 +1,34 @@
+// Copyright 2024 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package templates
+
+import (
+ "context"
+ "html/template"
+
+ "code.gitea.io/gitea/modules/timeutil"
+)
+
+type DateUtils struct {
+ ctx context.Context
+}
+
+func NewDateUtils(ctx context.Context) *DateUtils {
+ return &DateUtils{ctx}
+}
+
+// AbsoluteShort renders in "Jan 01, 2006" format
+func (du *DateUtils) AbsoluteShort(time any) template.HTML {
+ return timeutil.DateTime("short", time)
+}
+
+// AbsoluteLong renders in "January 01, 2006" format
+func (du *DateUtils) AbsoluteLong(time any) template.HTML {
+ return timeutil.DateTime("short", time)
+}
+
+// FullTime renders in "Jan 01, 2006 20:33:44" format
+func (du *DateUtils) FullTime(time any) template.HTML {
+ return timeutil.DateTime("full", time)
+}
diff --git a/routers/web/repo/activity.go b/routers/web/repo/activity.go
index 4b14c28b3e..65dd9e392f 100644
--- a/routers/web/repo/activity.go
+++ b/routers/web/repo/activity.go
@@ -48,8 +48,8 @@ func Activity(ctx *context.Context) {
ctx.Data["Period"] = "weekly"
timeFrom = timeUntil.Add(-time.Hour * 168)
}
- ctx.Data["DateFrom"] = timeFrom.UTC().Format(time.RFC3339)
- ctx.Data["DateUntil"] = timeUntil.UTC().Format(time.RFC3339)
+ ctx.Data["DateFrom"] = timeFrom
+ ctx.Data["DateUntil"] = timeUntil
ctx.Data["PeriodText"] = ctx.Tr("repo.activity.period." + ctx.Data["Period"].(string))
var err error
diff --git a/services/context/context.go b/services/context/context.go
index 42f7c3d9d1..322f228a4d 100644
--- a/services/context/context.go
+++ b/services/context/context.go
@@ -100,6 +100,7 @@ func NewTemplateContextForWeb(ctx *Context) TemplateContext {
tmplCtx := NewTemplateContext(ctx)
tmplCtx["Locale"] = ctx.Base.Locale
tmplCtx["AvatarUtils"] = templates.NewAvatarUtils(ctx)
+ tmplCtx["DateUtils"] = templates.NewDateUtils(ctx)
tmplCtx["RootData"] = ctx.Data
tmplCtx["Consts"] = map[string]any{
"RepoUnitTypeCode": unit.TypeCode,
diff --git a/templates/admin/auth/list.tmpl b/templates/admin/auth/list.tmpl
index 7057169895..4d4f022f41 100644
--- a/templates/admin/auth/list.tmpl
+++ b/templates/admin/auth/list.tmpl
@@ -26,8 +26,8 @@
<td><a href="{{AppSubUrl}}/-/admin/auths/{{.ID}}">{{.Name}}</a></td>
<td>{{.TypeName}}</td>
<td>{{svg (Iif .IsActive "octicon-check" "octicon-x")}}</td>
- <td>{{DateTime "short" .UpdatedUnix}}</td>
- <td>{{DateTime "short" .CreatedUnix}}</td>
+ <td>{{ctx.DateUtils.AbsoluteShort .UpdatedUnix}}</td>
+ <td>{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</td>
<td><a href="{{AppSubUrl}}/-/admin/auths/{{.ID}}">{{svg "octicon-pencil"}}</a></td>
</tr>
{{end}}
diff --git a/templates/admin/cron.tmpl b/templates/admin/cron.tmpl
index 1c16ed00ae..1174813f83 100644
--- a/templates/admin/cron.tmpl
+++ b/templates/admin/cron.tmpl
@@ -23,8 +23,8 @@
<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>
<td>{{ctx.Locale.Tr (printf "admin.dashboard.%s" .Name)}}</td>
<td>{{.Spec}}</td>
- <td>{{DateTime "full" .Next}}</td>
- <td>{{if gt .Prev.Year 1}}{{DateTime "full" .Prev}}{{else}}-{{end}}</td>
+ <td>{{ctx.DateUtils.FullTime .Next}}</td>
+ <td>{{if gt .Prev.Year 1}}{{ctx.DateUtils.FullTime .Prev}}{{else}}-{{end}}</td>
<td>{{.ExecTimes}}</td>
<td {{if ne .Status ""}}data-tooltip-content="{{.FormatLastMessage ctx.Locale}}"{{end}} >{{if eq .Status ""}}—{{else}}{{svg (Iif (eq .Status "finished") "octicon-check" "octicon-x") 16}}{{end}}</td>
</tr>
diff --git a/templates/admin/notice.tmpl b/templates/admin/notice.tmpl
index 6e7eed7678..395e1dcd46 100644
--- a/templates/admin/notice.tmpl
+++ b/templates/admin/notice.tmpl
@@ -21,7 +21,7 @@
<td>{{.ID}}</td>
<td>{{ctx.Locale.Tr .TrStr}}</td>
<td class="view-detail auto-ellipsis tw-w-4/5"><span class="notice-description">{{.Description}}</span></td>
- <td nowrap>{{DateTime "short" .CreatedUnix}}</td>
+ <td nowrap>{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</td>
<td class="view-detail"><a href="#">{{svg "octicon-note" 16}}</a></td>
</tr>
{{end}}
diff --git a/templates/admin/org/list.tmpl b/templates/admin/org/list.tmpl
index 987ceab1e0..6a6dc14609 100644
--- a/templates/admin/org/list.tmpl
+++ b/templates/admin/org/list.tmpl
@@ -63,7 +63,7 @@
<td>{{.NumTeams}}</td>
<td>{{.NumMembers}}</td>
<td>{{.NumRepos}}</td>
- <td>{{DateTime "short" .CreatedUnix}}</td>
+ <td>{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</td>
<td><a href="{{.OrganisationLink}}/settings" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a></td>
</tr>
{{end}}
diff --git a/templates/admin/packages/list.tmpl b/templates/admin/packages/list.tmpl
index a5ad93b89c..6f5cef7a7b 100644
--- a/templates/admin/packages/list.tmpl
+++ b/templates/admin/packages/list.tmpl
@@ -71,7 +71,7 @@
{{end}}
</td>
<td>{{FileSize .CalculateBlobSize}}</td>
- <td>{{DateTime "short" .Version.CreatedUnix}}</td>
+ <td>{{ctx.DateUtils.AbsoluteShort .Version.CreatedUnix}}</td>
<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>
</tr>
{{end}}
diff --git a/templates/admin/repo/list.tmpl b/templates/admin/repo/list.tmpl
index 77a275427a..1fd2f25fcf 100644
--- a/templates/admin/repo/list.tmpl
+++ b/templates/admin/repo/list.tmpl
@@ -82,8 +82,8 @@
<td>{{.NumIssues}}</td>
<td>{{FileSize .GitSize}}</td>
<td>{{FileSize .LFSSize}}</td>
- <td>{{DateTime "short" .UpdatedUnix}}</td>
- <td>{{DateTime "short" .CreatedUnix}}</td>
+ <td>{{ctx.DateUtils.AbsoluteShort .UpdatedUnix}}</td>
+ <td>{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</td>
<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>
</tr>
{{end}}
diff --git a/templates/admin/user/list.tmpl b/templates/admin/user/list.tmpl
index bc3d83fc5c..f7218ac2fa 100644
--- a/templates/admin/user/list.tmpl
+++ b/templates/admin/user/list.tmpl
@@ -96,9 +96,9 @@
<td>{{svg (Iif .IsActive "octicon-check" "octicon-x")}}</td>
<td>{{svg (Iif .IsRestricted "octicon-check" "octicon-x")}}</td>
<td>{{svg (Iif (index $.UsersTwoFaStatus .ID) "octicon-check" "octicon-x")}}</td>
- <td>{{DateTime "short" .CreatedUnix}}</td>
+ <td>{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</td>
{{if .LastLoginUnix}}
- <td>{{DateTime "short" .LastLoginUnix}}</td>
+ <td>{{ctx.DateUtils.AbsoluteShort .LastLoginUnix}}</td>
{{else}}
<td><span>{{ctx.Locale.Tr "admin.users.never_login"}}</span></td>
{{end}}
diff --git a/templates/explore/user_list.tmpl b/templates/explore/user_list.tmpl
index f2cf939ffb..ff46f13c17 100644
--- a/templates/explore/user_list.tmpl
+++ b/templates/explore/user_list.tmpl
@@ -21,7 +21,7 @@
<a href="mailto:{{.Email}}">{{.Email}}</a>
</span>
{{end}}
- <span class="flex-text-inline">{{svg "octicon-calendar"}}{{ctx.Locale.Tr "user.joined_on" (DateTime "short" .CreatedUnix)}}</span>
+ <span class="flex-text-inline">{{svg "octicon-calendar"}}{{ctx.Locale.Tr "user.joined_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}}</span>
</div>
</div>
</div>
diff --git a/templates/package/shared/cleanup_rules/preview.tmpl b/templates/package/shared/cleanup_rules/preview.tmpl
index cff8e8249f..f34112e026 100644
--- a/templates/package/shared/cleanup_rules/preview.tmpl
+++ b/templates/package/shared/cleanup_rules/preview.tmpl
@@ -22,7 +22,7 @@
<td><a href="{{.VersionWebLink}}">{{.Version.Version}}</a></td>
<td><a href="{{.Creator.HomeLink}}">{{.Creator.Name}}</a></td>
<td>{{FileSize .CalculateBlobSize}}</td>
- <td>{{DateTime "short" .Version.CreatedUnix}}</td>
+ <td>{{ctx.DateUtils.AbsoluteShort .Version.CreatedUnix}}</td>
</tr>
{{else}}
<tr>
diff --git a/templates/package/view.tmpl b/templates/package/view.tmpl
index 6beb249a7f..d104788483 100644
--- a/templates/package/view.tmpl
+++ b/templates/package/view.tmpl
@@ -92,7 +92,7 @@
{{range .LatestVersions}}
<div class="item tw-flex">
<a class="tw-flex-1 gt-ellipsis" title="{{.Version}}" href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .LowerVersion}}">{{.Version}}</a>
- <span class="text small">{{DateTime "short" .CreatedUnix}}</span>
+ <span class="text small">{{ctx.DateUtils.AbsoluteShort .CreatedUnix}}</span>
</div>
{{end}}
</div>
diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl
index f927501197..3e00700eb0 100644
--- a/templates/repo/diff/compare.tmpl
+++ b/templates/repo/diff/compare.tmpl
@@ -204,7 +204,7 @@
{{if .Repository.ArchivedUnix.IsZero}}
{{ctx.Locale.Tr "repo.archive.title"}}
{{else}}
- {{ctx.Locale.Tr "repo.archive.title_date" (DateTime "long" .Repository.ArchivedUnix)}}
+ {{ctx.Locale.Tr "repo.archive.title_date" (ctx.DateUtils.AbsoluteLong .Repository.ArchivedUnix)}}
{{end}}
</div>
{{end}}
diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl
index 7613643351..d7f05223af 100644
--- a/templates/repo/empty.tmpl
+++ b/templates/repo/empty.tmpl
@@ -10,7 +10,7 @@
{{if .Repository.ArchivedUnix.IsZero}}
{{ctx.Locale.Tr "repo.archive.title"}}
{{else}}
- {{ctx.Locale.Tr "repo.archive.title_date" (DateTime "long" .Repository.ArchivedUnix)}}
+ {{ctx.Locale.Tr "repo.archive.title_date" (ctx.DateUtils.AbsoluteLong .Repository.ArchivedUnix)}}
{{end}}
</div>
{{end}}
diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl
index 9b179552df..15443dec06 100644
--- a/templates/repo/graph/commits.tmpl
+++ b/templates/repo/graph/commits.tmpl
@@ -69,7 +69,7 @@
{{$userName}}
{{end}}
</span>
- <span class="time tw-flex tw-items-center">{{DateTime "full" $commit.Date}}</span>
+ <span class="time tw-flex tw-items-center">{{ctx.DateUtils.FullTime $commit.Date}}</span>
{{end}}
</li>
{{end}}
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index ff82f2ca80..f33a230c4b 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -37,7 +37,7 @@
{{if .Repository.ArchivedUnix.IsZero}}
{{ctx.Locale.Tr "repo.archive.title"}}
{{else}}
- {{ctx.Locale.Tr "repo.archive.title_date" (DateTime "long" .Repository.ArchivedUnix)}}
+ {{ctx.Locale.Tr "repo.archive.title_date" (ctx.DateUtils.AbsoluteLong .Repository.ArchivedUnix)}}
{{end}}
</div>
{{end}}
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index e49e90df56..69e4725fa1 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -368,7 +368,7 @@
<div class="tw-flex tw-justify-between tw-items-center">
<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}}>
{{svg "octicon-calendar" 16 "tw-mr-2"}}
- {{DateTime "long" .Issue.DeadlineUnix.FormatDate}}
+ {{ctx.DateUtils.AbsoluteLong .Issue.DeadlineUnix}}
</div>
<div>
{{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}}
diff --git a/templates/repo/pulse.tmpl b/templates/repo/pulse.tmpl
index e68109b755..0fe3da1884 100644
--- a/templates/repo/pulse.tmpl
+++ b/templates/repo/pulse.tmpl
@@ -1,5 +1,5 @@
<h2 class="ui header activity-header">
- <span>{{DateTime "long" .DateFrom}} - {{DateTime "long" .DateUntil}}</span>
+ <span>{{ctx.DateUtils.AbsoluteLong .DateFrom}} - {{ctx.DateUtils.AbsoluteLong .DateUntil}}</span>
<!-- Period -->
<div class="ui floating dropdown jump filter">
<div class="ui basic compact button">
diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl
index 190ca1af6c..8ab2adb60f 100644
--- a/templates/repo/settings/deploy_keys.tmpl
+++ b/templates/repo/settings/deploy_keys.tmpl
@@ -55,7 +55,7 @@
{{.Fingerprint}}
</div>
<div class="flex-item-body">
- <i>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateTime "short" .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></i>
+ <i>{{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></i>
</div>
</div>
<div class="flex-item-trailing">
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 8f71f0020f..1537a90043 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -117,7 +117,7 @@
<tr>
<td>{{.PullMirror.RemoteAddress}}</td>
<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td>
- <td>{{DateTime "full" .PullMirror.UpdatedUnix}}</td>
+ <td>{{ctx.DateUtils.FullTime .PullMirror.UpdatedUnix}}</td>
<td class="right aligned">
<form method="post" class="tw-inline-block">
{{.CsrfTokenHtml}}
@@ -205,7 +205,7 @@
<tr>
<td class="tw-break-anywhere">{{.RemoteAddress}}</td>
<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}</td>
- <td>{{if .LastUpdateUnix}}{{DateTime "full" .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>
+ <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>
<td class="right aligned">
<button
class="ui tiny button show-modal"
diff --git a/templates/repo/user_cards.tmpl b/templates/repo/user_cards.tmpl
index a3f36985f4..a0f4bf26d4 100644
--- a/templates/repo/user_cards.tmpl
+++ b/templates/repo/user_cards.tmpl
@@ -18,7 +18,7 @@
{{else if .Location}}
{{svg "octicon-location"}} {{.Location}}
{{else}}
- {{svg "octicon-calendar"}} {{ctx.Locale.Tr "user.joined_on" (DateTime "short" .CreatedUnix)}}
+ {{svg "octicon-calendar"}} {{ctx.Locale.Tr "user.joined_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}}
{{end}}
</div>
</li>
diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl
index 16c650ee3e..bd54cdb955 100644
--- a/templates/shared/issuelist.tmpl
+++ b/templates/shared/issuelist.tmpl
@@ -117,7 +117,7 @@
<span class="due-date flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date"}}">
<span{{if .IsOverdue}} class="text red"{{end}}>
{{svg "octicon-calendar" 14}}
- {{DateTime "short" (.DeadlineUnix.FormatDate)}}
+ {{ctx.DateUtils.AbsoluteShort .DeadlineUnix}}
</span>
</span>
{{end}}
diff --git a/templates/shared/secrets/add_list.tmpl b/templates/shared/secrets/add_list.tmpl
index ea59459083..011635a20d 100644
--- a/templates/shared/secrets/add_list.tmpl
+++ b/templates/shared/secrets/add_list.tmpl
@@ -28,7 +28,7 @@
</div>
<div class="flex-item-trailing">
<span class="color-text-light-2">
- {{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}}
+ {{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}}
</span>
<button class="ui btn interact-bg link-action tw-p-2"
data-url="{{$.Link}}/delete?id={{.ID}}"
diff --git a/templates/shared/user/profile_big_avatar.tmpl b/templates/shared/user/profile_big_avatar.tmpl
index 50d707176d..dd7a7547e8 100644
--- a/templates/shared/user/profile_big_avatar.tmpl
+++ b/templates/shared/user/profile_big_avatar.tmpl
@@ -79,7 +79,7 @@
</li>
{{end}}
{{end}}
- <li>{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (DateTime "short" .ContextUser.CreatedUnix)}}</span></li>
+ <li>{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (ctx.DateUtils.AbsoluteShort .ContextUser.CreatedUnix)}}</span></li>
{{if and .Orgs .HasOrgsVisible}}
<li>
<ul class="user-orgs">
diff --git a/templates/shared/variables/variable_list.tmpl b/templates/shared/variables/variable_list.tmpl
index 06c71c0610..0223e56f4e 100644
--- a/templates/shared/variables/variable_list.tmpl
+++ b/templates/shared/variables/variable_list.tmpl
@@ -30,7 +30,7 @@
</div>
<div class="flex-item-trailing">
<span class="color-text-light-2">
- {{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}}
+ {{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}}
</span>
<button class="btn interact-bg tw-p-2 show-modal"
data-tooltip-content="{{ctx.Locale.Tr "actions.variables.edit"}}"
diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl
index 65525aac2b..fdc7869fb7 100644
--- a/templates/user/settings/applications.tmpl
+++ b/templates/user/settings/applications.tmpl
@@ -36,7 +36,7 @@
</ul>
</details>
<div class="flex-item-body">
- <i>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</i>
+ <i>{{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}}</i>
</div>
</div>
<div class="flex-item-trailing">
diff --git a/templates/user/settings/grants_oauth2.tmpl b/templates/user/settings/grants_oauth2.tmpl
index b5ae3e0337..6ccab492aa 100644
--- a/templates/user/settings/grants_oauth2.tmpl
+++ b/templates/user/settings/grants_oauth2.tmpl
@@ -14,7 +14,7 @@
<div class="flex-item-main">
<div class="flex-item-title">{{.Application.Name}}</div>
<div class="flex-item-body">
- <i>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}}</i>
+ <i>{{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}}</i>
</div>
</div>
<div class="flex-item-trailing">
diff --git a/templates/user/settings/keys_gpg.tmpl b/templates/user/settings/keys_gpg.tmpl
index d86d838f18..a806f87df8 100644
--- a/templates/user/settings/keys_gpg.tmpl
+++ b/templates/user/settings/keys_gpg.tmpl
@@ -63,9 +63,9 @@
<b>{{ctx.Locale.Tr "settings.subkeys"}}:</b> {{range .SubsKey}} {{.PaddedKeyID}} {{end}}
</div>
<div class="flex-item-body">
- <i>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .AddedUnix)}}</i>
+ <i>{{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .AddedUnix)}}</i>
-
- <i>{{if not .ExpiredUnix.IsZero}}{{ctx.Locale.Tr "settings.valid_until_date" (DateTime "short" .ExpiredUnix)}}{{else}}{{ctx.Locale.Tr "settings.valid_forever"}}{{end}}</i>
+ <i>{{if not .ExpiredUnix.IsZero}}{{ctx.Locale.Tr "settings.valid_until_date" (ctx.DateUtils.AbsoluteShort .ExpiredUnix)}}{{else}}{{ctx.Locale.Tr "settings.valid_forever"}}{{end}}</i>
</div>
</div>
<div class="flex-item-trailing">
diff --git a/templates/user/settings/keys_principal.tmpl b/templates/user/settings/keys_principal.tmpl
index 37d8fb0e95..484a29e22a 100644
--- a/templates/user/settings/keys_principal.tmpl
+++ b/templates/user/settings/keys_principal.tmpl
@@ -22,7 +22,7 @@
<div class="flex-item-main">
<div class="flex-item-title">{{.Name}}</div>
<div class="flex-item-body">
- <i>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} — {{svg "octicon-info" 16}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</i>
+ <i>{{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}}</i>
</div>
</div>
<div class="flex-item-trailing">
diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl
index a2af1b7f82..0f72affa78 100644
--- a/templates/user/settings/keys_ssh.tmpl
+++ b/templates/user/settings/keys_ssh.tmpl
@@ -53,7 +53,7 @@
{{.Fingerprint}}
</div>
<div class="flex-item-body">
- <i>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</i>
+ <i>{{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}}</i>
</div>
</div>
<div class="flex-item-trailing">
diff --git a/templates/user/settings/security/webauthn.tmpl b/templates/user/settings/security/webauthn.tmpl
index 280ece9175..7a04a2681f 100644
--- a/templates/user/settings/security/webauthn.tmpl
+++ b/templates/user/settings/security/webauthn.tmpl
@@ -12,7 +12,7 @@
<div class="flex-item-main">
<div class="flex-item-title">{{.Name}}</div>
<div class="flex-item-body">
- <i>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}}</i>
+ <i>{{ctx.Locale.Tr "settings.added_on" (ctx.DateUtils.AbsoluteShort .CreatedUnix)}}</i>
</div>
</div>
<div class="flex-item-trailing">