diff options
author | Maksim Zakharov <m.zakharov@IBS.RU> | 2022-08-16 14:52:22 +0300 |
---|---|---|
committer | Maksim Zakharov <m.zakharov@IBS.RU> | 2022-08-16 14:52:22 +0300 |
commit | 55a58b2ee06b9cd54e28f61e9bdb0007836a5745 (patch) | |
tree | 515614eb9785c035d85d23cca601725e76141ca6 | |
parent | 2d2009540083a337f4dee62760c5d0cc94f9fb7a (diff) | |
download | webui-vue-55a58b2ee06b9cd54e28f61e9bdb0007836a5745.tar.xz |
fix format time
-rw-r--r-- | src/components/_sila/Mixins/LocalTimezoneLabelMixin.js | 3 | ||||
-rw-r--r-- | src/main.js | 13 |
2 files changed, 2 insertions, 14 deletions
diff --git a/src/components/_sila/Mixins/LocalTimezoneLabelMixin.js b/src/components/_sila/Mixins/LocalTimezoneLabelMixin.js index 6b4141c6..7ef7636b 100644 --- a/src/components/_sila/Mixins/LocalTimezoneLabelMixin.js +++ b/src/components/_sila/Mixins/LocalTimezoneLabelMixin.js @@ -4,8 +4,7 @@ const LocalTimezoneLabelMixin = { methods: { localOffset() { const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; - const shortTz = this.$options.filters.shortTimeZone(new Date()); - const pattern = `'${shortTz}' O`; + const pattern = ' O'; return format(new Date(), pattern, { timezone }).replace('GMT', 'UTC'); }, }, diff --git a/src/main.js b/src/main.js index ca17b958..e00d8868 100644 --- a/src/main.js +++ b/src/main.js @@ -44,16 +44,6 @@ import { format } from 'date-fns-tz'; import HighchartsVue from 'highcharts-vue'; import VueRandomColor from 'vue-randomcolor'; -// Filters -Vue.filter('shortTimeZone', function (value) { - const longTZ = value - .toString() - .match(/\((.*)\)/) - .pop(); - const regexNotUpper = /[*a-z ]/g; - return longTZ.replace(regexNotUpper, ''); -}); - Vue.filter('formatDate', function (value) { const isUtcDisplay = store.getters['global/isUtcDisplay']; @@ -79,8 +69,7 @@ Vue.filter('formatTime', function (value) { return `${value.toLocaleTimeString('default', timeOptions)} UTC`; } const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; - const shortTz = Vue.filter('shortTimeZone')(value); - const pattern = `HH:mm:ss ('${shortTz}' O)`; + const pattern = `HH:mm:ss O`; return format(value, pattern, { timezone }).replace('GMT', 'UTC'); } }); |