From b590c4ca52f15164f80f3f01c294e87f358090c1 Mon Sep 17 00:00:00 2001 From: Arth <65160206@go.buu.ac.th> Date: Fri, 28 Mar 2025 01:52:37 +0700 Subject: [PATCH] fix time --- src/components/GanttChart/GanttChart.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/GanttChart/GanttChart.vue b/src/components/GanttChart/GanttChart.vue index 15b616f..8fc0e8d 100644 --- a/src/components/GanttChart/GanttChart.vue +++ b/src/components/GanttChart/GanttChart.vue @@ -108,6 +108,9 @@ import AddQueueDialog from './AddQueueDialog.vue' import MakequeueBtn from './MakequeueBtn.vue' import SettingBtn from './SettingBtn.vue' import './ganttChart.css' +import dayjs from 'dayjs' +import utc from 'dayjs/plugin/utc' +import timezone from 'dayjs/plugin/timezone' // Stores const queueStore = useQueueStore() @@ -217,9 +220,11 @@ function clearOriginalMaps() { Object.keys(originalColorMap).forEach((k) => delete originalColorMap[+k]) } +dayjs.extend(utc) +dayjs.extend(timezone) + function convertToLocalTime(utcString: string): string { - const date = new Date(utcString) - return date.toLocaleString("th-TH", { timeZone: "Asia/Bangkok" }) + return dayjs.utc(utcString).tz("Asia/Bangkok").format("YYYY-MM-DD HH:mm") } // Pagination & Dialog -- GitLab