From e05261a020139f44002ca815517d793f42422aa4 Mon Sep 17 00:00:00 2001
From: Yuval Adam <_@yuv.al>
Date: Mon, 30 Oct 2017 12:18:30 +0200
Subject: Use timezone aware date and time

---
 Geshem.vue | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'Geshem.vue')

diff --git a/Geshem.vue b/Geshem.vue
index 76b0605..b0feb52 100644
--- a/Geshem.vue
+++ b/Geshem.vue
@@ -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 () {
-- 
cgit v1.3.1

