diff options
| author | Yuval Adam <_@yuv.al> | 2017-10-30 12:18:30 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2017-10-30 12:18:30 +0200 |
| commit | e05261a020139f44002ca815517d793f42422aa4 (patch) | |
| tree | 946f017ac60362b34ac2bd688c22093cafe21bbb /Geshem.vue | |
| parent | 4a7c8a531e4745c0c8a2966bd5de46e521445713 (diff) | |
Use timezone aware date and time
Diffstat (limited to 'Geshem.vue')
| -rw-r--r-- | Geshem.vue | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -14,6 +14,8 @@ import axios from 'axios'; import vueSlider from 'vue-slider-component'; import mapboxgl from 'mapbox-gl'; + import moment from 'moment-timezone'; + export default { name: 'geshem', components: { @@ -52,15 +54,19 @@ } }, computed: { + datetime: function () { + if (!this.imgs) { return '' }; + var d = this.imgs[this.res][this.slider].substr(0, 13); + var md = moment.utc(d, 'YYYYMMDD/HHmm').tz('Asia/Jerusalem'); + return md + }, date: function () { if (!this.imgs) { return '' }; - var d = this.imgs[this.res][this.slider].substr(0, 8); - return `${d.substr(6, 2)}-${d.substr(4, 2)}-${d.substr(0, 4)}`; + return this.datetime.format('YYYY-MM-DD'); }, time: function () { if (!this.imgs) { return '' }; - var t = this.imgs[this.res][this.slider].substr(9, 6); - return `${t.substr(0, 2)}:${t.substr(2, 2)}`; + return this.datetime.format('HH:mm'); } }, mounted: function () { |
