Fix: gunakan Intl.DateTimeFormat dengan timezone Asia/Jakarta untuk konsistensi di semua browser dan server
This commit is contained in:
@@ -842,10 +842,18 @@
|
||||
setInterval(updateRealtimeStatus, 1000);
|
||||
|
||||
// Helper function untuk mendapatkan tanggal hari ini dalam timezone Indonesia (UTC+7)
|
||||
// Menggunakan Intl.DateTimeFormat untuk mendapatkan tanggal yang konsisten di semua browser
|
||||
function getTodayIndonesia() {
|
||||
const now = new Date();
|
||||
const indonesiaTime = new Date(now.getTime() + (7 * 60 * 60 * 1000)); // UTC+7
|
||||
return indonesiaTime.toISOString().split('T')[0];
|
||||
// Format tanggal dalam timezone Asia/Jakarta (UTC+7)
|
||||
const formatter = new Intl.DateTimeFormat('en-CA', {
|
||||
timeZone: 'Asia/Jakarta',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit'
|
||||
});
|
||||
// Format: YYYY-MM-DD
|
||||
return formatter.format(now);
|
||||
}
|
||||
|
||||
// Init
|
||||
|
||||
Reference in New Issue
Block a user