Fix: gunakan Intl.DateTimeFormat dengan timezone Asia/Jakarta untuk konsistensi di semua browser dan server
This commit is contained in:
@@ -94,8 +94,14 @@ class RealtimeManager {
|
||||
// Struktur response setelah di-unwrap: { total_count_today, total_amount_today, by_gate, by_category }
|
||||
// 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];
|
||||
// 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'
|
||||
});
|
||||
const today = formatter.format(now);
|
||||
const snapshot = await apiGetRealtimeSnapshot({
|
||||
date: today,
|
||||
location_code: '' // bisa diambil dari state dashboard jika perlu
|
||||
|
||||
Reference in New Issue
Block a user