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 | |
| parent | 4a7c8a531e4745c0c8a2966bd5de46e521445713 (diff) | |
Use timezone aware date and time
| -rw-r--r-- | Geshem.vue | 14 | ||||
| -rw-r--r-- | package.json | 21 | ||||
| -rw-r--r-- | yarn.lock | 8 |
3 files changed, 28 insertions, 15 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 () { diff --git a/package.json b/package.json index c430998..1c2bacd 100644 --- a/package.json +++ b/package.json @@ -15,25 +15,26 @@ "dependencies": { "aws-sdk": "^2.138.0", "axios": "^0.16.2", - "express": "^4.16.2", - "mapbox-gl": "^0.40.1", - "moment": "^2.19.1", - "pug": "^2.0.0-rc.4", - "redis": "^2.8.0", - "request": "^2.83.0", - "vue": "^2.4.4", - "vue-slider-component": "^2.4.3", - "webpack": "^3.8.1", "babel-core": "^6.26.0", "babel-loader": "^7.1.2", "babel-preset-env": "^1.6.0", "cross-env": "^5.0.5", "css-loader": "^0.28.7", + "express": "^4.16.2", "file-loader": "^1.1.5", + "mapbox-gl": "^0.40.1", + "moment": "^2.19.1", + "moment-timezone": "^0.5.13", "node-sass": "^4.5.3", + "pug": "^2.0.0-rc.4", + "redis": "^2.8.0", + "request": "^2.83.0", "sass-loader": "^6.0.6", + "vue": "^2.4.4", "vue-loader": "^13.3.0", - "vue-template-compiler": "^2.5.2" + "vue-slider-component": "^2.4.3", + "vue-template-compiler": "^2.5.2", + "webpack": "^3.8.1" }, "private": false } @@ -3004,7 +3004,13 @@ mixin-object@^2.0.1: dependencies: minimist "0.0.8" -moment@^2.19.1: +moment-timezone@^0.5.13: + version "0.5.13" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.13.tgz#99ce5c7d827262eb0f1f702044177f60745d7b90" + dependencies: + moment ">= 2.9.0" + +"moment@>= 2.9.0", moment@^2.19.1: version "2.19.1" resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.1.tgz#56da1a2d1cbf01d38b7e1afc31c10bcfa1929167" |
