🐛 Fix: use dateFormat function to render localized dates

Co-authored-by: Stefano Ginobili <stefano.ginobili@gmail.com>
Co-authored-by: Cell <1024@lruihao.cn>
(cherry picked from commit 78416fa920)
This commit is contained in:
Stefano Ginobili
2023-09-02 17:27:35 +02:00
committed by Cell
parent 1b359b7f14
commit 2956b9927c
7 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -42,7 +42,7 @@
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
{{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}}
{{- .Date | dateFormat ($.Site.Params.section.dateFormat | default "01-02") -}}
</span>
</article>
{{- end -}}
+1 -1
View File
@@ -34,7 +34,7 @@
<div class="post-meta">
{{- partial "single/post-author.html" . -}}
{{- with .Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format -}}
{{- with .PublishDate | dateFormat (.Site.Params.dateFormat | default "2006-01-02") -}}
&nbsp;<span class="post-publish" title='{{ "2006-01-02 15:04:05" | $.PublishDate.Format }}'>
{{- printf `<time datetime="%v">%v</time>` . . | dict "Date" | T "single.publishedOnDate" | safeHTML -}}
</span>
+1 -1
View File
@@ -14,7 +14,7 @@
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Lastmod.Format }}'>
{{- with .Site.Params.section.dateformat | default "01-02" | .Lastmod.Format -}}
{{- with .Lastmod | dateFormat (.Site.Params.section.dateformat | default "01-02") -}}
{{- dict "Date" . | T "single.updatedOnDate" -}}
{{- end -}}
</span>
@@ -20,7 +20,7 @@
</div>
<div class="details-content">
<div class="admonition-content">
{{- with .Site.Params.dateformat | default "2006-01-02" | $updateTime.Format -}}
{{- with $updateTime | dateFormat (.Site.Params.dateformat | default "2006-01-02") -}}
{{- dict "Date" . | T "single.expirationReminder" -}}
{{- end -}}
</div>
+1 -1
View File
@@ -6,7 +6,7 @@
<div class="post-info-line">
<div class="post-info-mod">
<span title="{{ dict "Date" ("2006-01-02 15:04:05" | .Lastmod.Format) | T "single.updatedOnDate" }}">
{{- with .Site.Params.dateformat | default "2006-01-02" | .Lastmod.Format -}}
{{- with .Lastmod | dateFormat (.Site.Params.dateformat | default "2006-01-02") -}}
{{- dict "Date" . | T "single.updatedOnDate" -}}&nbsp;
{{- if $gitRepo -}}
{{- with $.GitInfo -}}
+2 -2
View File
@@ -61,13 +61,13 @@
{{- end -}}
</div>
<div class="post-meta-line">
{{- with .Site.Params.dateformat | default "2006-01-02" | .PublishDate.Format -}}
{{- with .PublishDate | dateFormat (.Site.Params.dateformat | default "2006-01-02") -}}
<span title="{{ dict "Date" ("2006-01-02 15:04:05" | $.PublishDate.Format) | T "single.publishedOnDate" }}">
{{- dict "Class" "fa-regular fa-calendar-alt fa-fw me-1" | partial "plugin/icon.html" -}}
{{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}}
</span>&nbsp;
{{- end -}}
{{- with .Site.Params.dateformat | default "2006-01-02" | .Lastmod.Format -}}
{{- with .Lastmod | dateFormat (.Site.Params.dateformat | default "2006-01-02") -}}
<span title="{{ dict "Date" ("2006-01-02 15:04:05" | $.Lastmod.Format) | T "single.updatedOnDate" }}">
{{- dict "Class" "fa-regular fa-edit fa-fw me-1" | partial "plugin/icon.html" -}}
{{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}}
+2 -2
View File
@@ -32,8 +32,8 @@
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<span class="archive-item-date" title={{ "2006-01-02 15:04:05" | .Date.Format }}>
{{- $.Site.Params.list.dateFormat | default "01-02" | .Date.Format -}}
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
{{- .Date | dateFormat ($.Site.Params.list.dateFormat | default "01-02") -}}
</span>
</article>
{{- end -}}