]> source.dussan.org Git - gitea.git/commitdiff
Replace DateTime with DateUtils (#32383)
authorwxiaoguang <wxiaoguang@gmail.com>
Sat, 2 Nov 2024 04:08:28 +0000 (12:08 +0800)
committerGitHub <noreply@github.com>
Sat, 2 Nov 2024 04:08:28 +0000 (04:08 +0000)
33 files changed:
modules/templates/helper.go
modules/templates/util_date.go [new file with mode: 0644]
routers/web/repo/activity.go
services/context/context.go
templates/admin/auth/list.tmpl
templates/admin/cron.tmpl
templates/admin/notice.tmpl
templates/admin/org/list.tmpl
templates/admin/packages/list.tmpl
templates/admin/repo/list.tmpl
templates/admin/user/list.tmpl
templates/explore/user_list.tmpl
templates/package/shared/cleanup_rules/preview.tmpl
templates/package/view.tmpl
templates/repo/diff/compare.tmpl
templates/repo/empty.tmpl
templates/repo/graph/commits.tmpl
templates/repo/home.tmpl
templates/repo/issue/view_content/sidebar.tmpl
templates/repo/pulse.tmpl
templates/repo/settings/deploy_keys.tmpl
templates/repo/settings/options.tmpl
templates/repo/user_cards.tmpl
templates/shared/issuelist.tmpl
templates/shared/secrets/add_list.tmpl
templates/shared/user/profile_big_avatar.tmpl
templates/shared/variables/variable_list.tmpl
templates/user/settings/applications.tmpl
templates/user/settings/grants_oauth2.tmpl
templates/user/settings/keys_gpg.tmpl
templates/user/settings/keys_principal.tmpl
templates/user/settings/keys_ssh.tmpl
templates/user/settings/security/webauthn.tmpl

index 5f73e6b278cdb86bd37980083d472973b5143138..5038e8a1327b9d79026b6919b4431a1cd824e0b3 100644 (file)
@@ -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 (file)
index 0000000..ec48a7e
--- /dev/null
@@ -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)
+}
index 4b14c28b3e635bb1e6c4ad8e1ca1f754f8b9537b..65dd9e392f3384ce4e52827dfe514667d4417eb4 100644 (file)
@@ -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
index 42f7c3d9d1d8afa6721c7fd55083bd7fe4528900..322f228a4d00c18ab67b45297924d3f5e608f703 100644 (file)
@@ -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,
index 7057169895763a763cddb2320c45499810614c21..4d4f022f41d74ef80d7f446ec3eda1122768c81a 100644 (file)
@@ -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}}
index 1c16ed00ae2fbcf4d97d70e6062fdc1a47828bb1..1174813f837ca2b896c4cc7c63835ba03480d5dc 100644 (file)
@@ -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>
index 6e7eed76785caf57eb51639c9df343ab4c825692..395e1dcd467bbe8d01dfb5ca359d0415c73b18a5 100644 (file)
@@ -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}}
index 987ceab1e0f99044f156475a46a6e1463b63161a..6a6dc14609cfce3b44b615e3bb2ba801b9805d83 100644 (file)
@@ -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}}
index a5ad93b89c04c21535e62134cd106d5d773a68d1..6f5cef7a7b296cd100a9e0aa016471cb96f27ca8 100644 (file)
@@ -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}}
index 77a275427ae5179540e1f5dd654562159d393d24..1fd2f25fcf52e69608c4c54306cb1f789913b770 100644 (file)
@@ -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}}
index bc3d83fc5c37a0ca787d30e6683fc4112aa0ff6b..f7218ac2faa7280d79aa0929d141b888443ca32e 100644 (file)
@@ -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}}
index f2cf939ffb8e1295db430c0c0b0f48a38188de90..ff46f13c1770f0ec1c08b25de6ffe506c78576d8 100644 (file)
@@ -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>
index cff8e8249f46fe749bd0ebf62ee9a3d9a820b793..f34112e026d5ee31182e90dc2e91a7d58ea35eed 100644 (file)
@@ -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>
index 6beb249a7ffc2c4cbeb28b159aa63756ca65bc9b..d104788483e030cdce603a737f6f7f45f0186b52 100644 (file)
@@ -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>
index f92750119719a4978ea9323185b0b79a6875e983..3e00700eb0b11c6437e967108f71d1cfcf5c1df1 100644 (file)
                                        {{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}}
index 76136433515775f87ee70ff224bd671d11806dea..d7f05223af48ad8755ead6df007e320755334d4c 100644 (file)
@@ -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}}
index 9b179552df86c03f6879b015ccfc53e304cee988..15443dec060f1baa4541958975d72c2157f35b33 100644 (file)
@@ -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}}
index ff82f2ca803605dc51ae8b976b7199cced254cfa..f33a230c4b6e4b2b8a403d8df9d54a23a6753785 100644 (file)
@@ -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}}
index e49e90df56c9fc706d873497e64fbaefb57037c5..69e4725fa1122a716766a390a599ae2fd36ff215 100644 (file)
                                <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)}}
index e68109b75579a60d4c3177cc55542d313fe6d5c0..0fe3da1884d343b36eec7ff5f9c691f8eacdabf0 100644 (file)
@@ -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">
index 190ca1af6ce4bc49ace13cc0ede7e4433bf83a98..8ab2adb60fd2597d23af7870db9e42eb23557196 100644 (file)
@@ -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">
index 8f71f0020f1a0fb8e19fbe624d95da91f4e5e730..1537a90043813a07c0c24862638660fca79c6d35 100644 (file)
                                                        <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}}
                                                        <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"
index a3f36985f482498108219317153ff700a3a39170..a0f4bf26d4ec8ef64d6656499fa5e9d1716eb9f0 100644 (file)
@@ -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>
index 16c650ee3e45e4132d6e35e7d0090fd79ea4b000..bd54cdb955e28f5bb15dda6077452572bec203e9 100644 (file)
                                                <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}}
index ea59459083e6e36b35090ca0ca9a5d5c8746bab3..011635a20d20883634676160dfe61a0ac7a14331 100644 (file)
@@ -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}}"
index 50d707176d544197543dd7afe2a93478cc33955a..dd7a7547e8c936d55b3bf9cab50d03181d9e726e 100644 (file)
@@ -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">
index 06c71c0610473712385b7f92b17a3df0921886d6..0223e56f4e949deb5db7d6f01a3c5623094abca1 100644 (file)
@@ -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"}}"
index 65525aac2b213c1b842b34aa22b554b600e74752..fdc7869fb7b38d0d3d8f5fcbe45de7b959be7333 100644 (file)
@@ -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">
index b5ae3e03371b193eba1f3383d136280b08150fca..6ccab492aaa60f237b6ae3d171366db86ba90888 100644 (file)
@@ -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">
index d86d838f184291a3d794d756713c1bcd8a84f2f9..a806f87df845b7a2f6ecb145a8eafa91e9330767 100644 (file)
@@ -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">
index 37d8fb0e9567a5b5ea46cc881fba6a16ab13798c..484a29e22a0b2ae2cad231119dab150c4b431953 100644 (file)
@@ -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">
index a2af1b7f8216497460d39d997f0b8024aee37b5b..0f72affa78fabb3dc0d4cedd109d5cc1089066de 100644 (file)
@@ -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">
index 280ece9175b48047ec34eb0cef052b70e2fb9c68..7a04a2681fcae9a0c6d58f276305cc7a640751ed 100644 (file)
@@ -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">