Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 77003a34 authored by 65160206's avatar 65160206
Browse files

fix date localhost

parent 7be0935e
No related branches found
No related tags found
No related merge requests found
Pipeline #671 failed
......@@ -220,12 +220,23 @@ function clearOriginalMaps() {
function convertToLocalTime(utcString: string): string {
const d = new Date(utcString)
const isLocalhost = ['localhost', '127.0.0.1'].includes(window.location.hostname)
if (isLocalhost) {
// 🟢 แปลงเป็น local time (Asia/Bangkok)
d.setHours(d.getHours() + 7) // ปรับ +7 ชั่วโมง
const iso = d.toISOString()
// 🟢 คืนแบบไม่แปลง timezone (แค่ตัดเวลาให้ format สวย)
return iso.slice(0, 16).replace('T', ' ')
} else {
// 🔵 Prod → ไม่แปลง timezone, แค่ format สวย ๆ
const iso = d.toISOString()
return iso.slice(0, 16).replace('T', ' ')
}
}
// Pagination & Dialog
const pages = computed(() => pageStore.pages.map((p) => p.pagenum))
const pageToShowDelete = ref<number | null>(null)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment