From 445e7b82ffb5188e49d8791c737cc633dc962a69 Mon Sep 17 00:00:00 2001 From: mwpn Date: Fri, 19 Dec 2025 05:37:46 +0700 Subject: [PATCH] Fix: tambah helper function getTodayIndonesia di event.html juga --- public/dashboard/event.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/public/dashboard/event.html b/public/dashboard/event.html index 44ed431..d076cd9 100644 --- a/public/dashboard/event.html +++ b/public/dashboard/event.html @@ -841,14 +841,20 @@ // Update status setiap detik setInterval(updateRealtimeStatus, 1000); + // Helper function untuk mendapatkan tanggal hari ini dalam timezone Indonesia (UTC+7) + function getTodayIndonesia() { + const now = new Date(); + const indonesiaTime = new Date(now.getTime() + (7 * 60 * 60 * 1000)); // UTC+7 + return indonesiaTime.toISOString().split('T')[0]; + } + // Init document.addEventListener('DOMContentLoaded', async () => { // Set default date ke hari ini (selalu update ke hari ini setiap kali page load) // Gunakan timezone Indonesia (UTC+7) untuk mendapatkan tanggal lokal yang benar - const now = new Date(); - const indonesiaTime = new Date(now.getTime() + (7 * 60 * 60 * 1000)); // UTC+7 - const today = indonesiaTime.toISOString().split('T')[0]; + const today = getTodayIndonesia(); state.date = today; + const now = new Date(); console.log('[Events] Default date set to today (Indonesia timezone):', state.date, 'UTC time:', now.toISOString()); // Set dateInput value SECARA LANGSUNG untuk override browser cache/autofill