Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/vickylaixy/hugo-theme-introduction.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/index.html')
-rw-r--r--layouts/index.html17
1 files changed, 10 insertions, 7 deletions
diff --git a/layouts/index.html b/layouts/index.html
index fd1787c..d9243c3 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -106,7 +106,7 @@
{{ .Content }}
</div>
{{ if .Site.Params.home.localTime }}
- <p>{{ i18n "index_currentTime" . }} <span id="time" data-time-zone="{{ .Site.Params.home.timeZone }}" data-time-format="{{ .Site.Params.home.timeFormat }}"></span>.</p>
+ <p>{{ i18n "index_currentTime" . }} <span id="time"></span>.</p>
{{ end }}
{{ with .Site.Params.email }}
<h3 class="subtitle is-3 has-text-centered top-pad">
@@ -132,12 +132,15 @@
{{ partial "js/owlCarousel.html" . }}
{{ if .Site.Params.home.localTime }}
- {{ $momentjs := resources.Get "vendor/momentjs/moment.min.js" }}
- {{ $momentTimezone := resources.Get "vendor/momentjs/moment-timezone.min.js" }}
- {{ $momentTimezoneWithData := resources.Get "vendor/momentjs/moment-timezone-with-data-2012-2022.min.js" }}
- {{ $initMomentjs := resources.Get "js/initMoment.js" }}
- {{ $bundleMoment := slice $momentjs $momentTimezone $momentTimezoneWithData $initMomentjs | resources.Concat "js/bundleMoment.js" | fingerprint }}
- <script src="{{ $bundleMoment.Permalink }}" integrity="{{ $bundleMoment.Data.Integrity }}"></script>
+ <script>
+ function update_localtime() {
+ const time = new Date().toLocaleTimeString('{{ .Site.Params.home.timeFormat }}', { timeZone: '{{ .Site.Params.home.timeZone }}', timeStyle: 'short' });
+ document.getElementById('time').innerHTML = time;
+ }
+ update_localtime();
+ // Updating every second to prevent seconds looking like stood still when timeStyle is ignored.
+ setInterval(update_localtime, 1000);
+ </script>
{{ end }}
</body>