mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-11-09 23:09:47 +00:00
Fix timezone
This commit is contained in:
parent
b7f6532d04
commit
ebd3b152f4
3 changed files with 9 additions and 12 deletions
|
@ -22,10 +22,3 @@ $(document).keypress(function(e) {
|
|||
$('.modal.is-active').removeClass('is-active');
|
||||
}
|
||||
});
|
||||
|
||||
{{ if and .Site.Params.localTime .Page.IsHome }}
|
||||
$(document).ready(function() {
|
||||
var time = moment().tz("{{ .Site.Params.timeZone }}").format("h:mm A");
|
||||
$('#time').html(time);
|
||||
})
|
||||
{{ end }}
|
||||
|
|
4
assets/js/initMoment.js
Normal file
4
assets/js/initMoment.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
$(document).ready(function() {
|
||||
var time = moment().tz("{{ .Site.Params.timeZone }}").format("h:mm A");
|
||||
$('#time').html(time);
|
||||
})
|
|
@ -1,14 +1,14 @@
|
|||
{{ $jQuery := resources.Get "vendor/jquery/jquery-3.3.1.min.js" }}
|
||||
{{ $index := resources.Get "js/index.js" | resources.ExecuteAsTemplate "js/index.tmp.css" . | minify }}
|
||||
{{ $index := resources.Get "js/index.js" | minify }}
|
||||
{{ $scripts := slice $jQuery $index | resources.Concat "/js/bundle.js" | fingerprint }}
|
||||
<script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script>
|
||||
|
||||
{{ if and .Site.Params.localTime .Page.IsHome }}
|
||||
{{ $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" }}
|
||||
{{ $scripts := slice $jQuery $momentjs $momentTimezone $momentTimezoneWithData $index | resources.Concat "/js/bundleMoment.js" | fingerprint }}
|
||||
<script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script>
|
||||
{{ else }}
|
||||
{{ $scripts := slice $jQuery $index | resources.Concat "/js/bundle.js" | fingerprint }}
|
||||
{{ $initMomentjs := resources.Get "js/initMoment.js" | resources.ExecuteAsTemplate "js/initMoment.tmp.js" . }}
|
||||
{{ $scripts := slice $momentjs $momentTimezone $momentTimezoneWithData $initMomentjs | resources.Concat "/js/bundleMoment.js" | fingerprint }}
|
||||
<script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
|
||||
|
|
Loading…
Reference in a new issue