From 55a58b2ee06b9cd54e28f61e9bdb0007836a5745 Mon Sep 17 00:00:00 2001 From: Maksim Zakharov Date: Tue, 16 Aug 2022 14:52:22 +0300 Subject: fix format time --- src/components/_sila/Mixins/LocalTimezoneLabelMixin.js | 3 +-- 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'); } }); -- cgit v1.2.3