aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMantas Vilčinskas <hi@mnts.lt>2023-12-01 14:09:01 +0200
committerGitHub <noreply@github.com>2023-12-01 14:09:01 +0200
commitdbdd52c835d5cf6eae7f4f4c00684094748e2c52 (patch)
tree2cac60b406e6ec242eb550311917a2907db67243
parenta698a01934c5975fa46672e775c24d81d1e6b817 (diff)
parent0671bb2dcdc6aea97e40bab2e8d709925c2b6471 (diff)
use dateFormat instead of .Date.Format for better localization #274 from MirMiz/dateformat-fix
-rw-r--r--layouts/issues/issue.html2
-rw-r--r--layouts/issues/single.html2
-rw-r--r--layouts/issues/small.html14
-rw-r--r--layouts/partials/js.html2
4 files changed, 10 insertions, 10 deletions
diff --git a/layouts/issues/issue.html b/layouts/issues/issue.html
index c010502..513d884 100644
--- a/layouts/issues/issue.html
+++ b/layouts/issues/issue.html
@@ -12,7 +12,7 @@
<small class="date">
{{ if .Site.Params.dateFormat }}
- {{ .Date.Format .Site.Params.dateFormat }}
+ {{ dateFormat .Site.Params.dateFormat .Params.date }}
{{ else }}
{{ .Date.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
diff --git a/layouts/issues/single.html b/layouts/issues/single.html
index 0dd8052..9aa135b 100644
--- a/layouts/issues/single.html
+++ b/layouts/issues/single.html
@@ -21,7 +21,7 @@
<p>{{ T "lastChecked" }}:
{{ if .Site.Params.dateFormat }}
- {{ .Lastmod.Format .Site.Params.dateFormat }}
+ {{ dateFormat .Site.Params.dateFormat .Lastmod }}
{{ else }}
{{ .Lastmod.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
diff --git a/layouts/issues/small.html b/layouts/issues/small.html
index 97baec9..cac8109 100644
--- a/layouts/issues/small.html
+++ b/layouts/issues/small.html
@@ -8,9 +8,9 @@
<a href="{{ .Permalink }}" class="issue no-underline">
{{ if .Params.informational }}
- <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
+ <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ dateFormat .Site.Params.dateFormat .Params.date }}" data-date="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
{{ if .Site.Params.dateFormat }}
- {{ .Date.Format .Site.Params.dateFormat }}
+ {{ dateFormat .Site.Params.dateFormat .Params.date }}
{{ else }}
{{ .Date.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
@@ -23,9 +23,9 @@
</span>
{{ else if .Params.Resolved }}
- <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
+ <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ dateFormat .Site.Params.dateFormat .Params.date }}" data-date="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
{{ if .Site.Params.dateFormat }}
- {{ .Date.Format .Site.Params.dateFormat }}
+ {{ dateFormat .Site.Params.dateFormat .Params.date }}
{{ else }}
{{ .Date.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
@@ -73,11 +73,11 @@
{{ else }}
<!-- If not resolved -->
- <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
+ <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ dateFormat .Site.Params.dateFormat .Params.date }}" data-date="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
{{ if .Date.Before now }}
{{ if .Site.Params.dateFormat }}
- {{ .Date.Format .Site.Params.dateFormat }}
+ {{ dateFormat .Site.Params.dateFormat .Params.date }}
{{ else }}
{{ .Date.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
@@ -99,7 +99,7 @@
{{ T "downtimeOngoing" }}
{{ else }}
{{ if .Site.Params.dateFormat }}
- {{ .Date.Format .Site.Params.dateFormat }}
+ {{ dateFormat .Site.Params.dateFormat .Params.date }}
{{ else }}
{{ .Date.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
diff --git a/layouts/partials/js.html b/layouts/partials/js.html
index 2e06196..b7dad07 100644
--- a/layouts/partials/js.html
+++ b/layouts/partials/js.html
@@ -103,7 +103,7 @@
var elements = document.querySelectorAll('.relative-time');
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
- var time = Date.parse(element.getAttribute('title'));
+ var time = Date.parse(element.dataset.date);
var html = element.getAttribute('data-time-prefix') || '';