This is an automated email from the ASF dual-hosted git repository.

qiuxiafan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-booster-ui.git


The following commit(s) were added to refs/heads/main by this push:
     new 3938853  fix utc (#71)
3938853 is described below

commit 393885324b9574c4cac0efd8e7cda9ef6005536f
Author: Fine0830 <[email protected]>
AuthorDate: Thu Apr 21 12:39:06 2022 +0800

    fix utc (#71)
---
 src/store/modules/app.ts | 11 ++++++-----
 src/views/Settings.vue   |  5 ++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts
index 8c320e9..8e3de40 100644
--- a/src/store/modules/app.ts
+++ b/src/store/modules/app.ts
@@ -88,12 +88,9 @@ export const appStore = defineStore({
               this.duration.start.getMonth());
           break;
       }
-      const utcArr = this.utc.split(":");
-      const utcHour = isNaN(Number(utcArr[0])) ? 0 : Number(utcArr[0]);
-      const utcMin = isNaN(Number(utcArr[1])) ? 0 : Number(utcArr[1]);
       const utcSpace =
-        (utcHour + new Date().getTimezoneOffset() / 60) * 3600000 +
-        utcMin * 60000;
+        (this.utcHour + new Date().getTimezoneOffset() / 60) * 3600000 +
+        this.utcMin * 60000;
       const startUnix: number = this.duration.start.getTime();
       const endUnix: number = this.duration.end.getTime();
       const timeIntervals: string[] = [];
@@ -155,6 +152,10 @@ export const appStore = defineStore({
       }
       this.utc = res.data.data.getTimeInfo.timezone / 100 + ":0";
 
+      const utcArr = this.utc.split(":");
+      this.utcHour = isNaN(Number(utcArr[0])) ? 0 : Number(utcArr[0]);
+      this.utcMin = isNaN(Number(utcArr[1])) ? 0 : Number(utcArr[1]);
+
       return res.data;
     },
     async fetchVersion(): Promise<void> {
diff --git a/src/views/Settings.vue b/src/views/Settings.vue
index 79c2fbd..5e06286 100644
--- a/src/views/Settings.vue
+++ b/src/views/Settings.vue
@@ -84,9 +84,8 @@ const state = reactive<{ timer: ReturnType<typeof 
setInterval> | null }>({
 const lang = ref<string>(locale.value || "en");
 const autoTime = ref<number>(6);
 const auto = ref<boolean>(appStore.autoRefresh || false);
-const utcArr = appStore.utc.split(":");
-const utcHour = ref<number>(isNaN(Number(utcArr[0])) ? 0 : Number(utcArr[0]));
-const utcMin = ref<number>(isNaN(Number(utcArr[1])) ? 0 : Number(utcArr[1]));
+const utcHour = ref<number>(appStore.utcHour);
+const utcMin = ref<number>(appStore.utcMin);
 
 appStore.setPageTitle("Setting");
 const handleReload = () => {

Reply via email to