Fix timezone: Konversi waktu grafik dari UTC ke WIB (UTC+7)

This commit is contained in:
flemss 2026-06-15 03:50:06 +07:00
parent 3448854cde
commit 8f27c7535e
1 changed files with 3 additions and 1 deletions

View File

@ -192,8 +192,10 @@ export default function ControlPanel() {
// Convert data ke format grafik (24 jam terakhir)
const chartData: DataPoint[] = result.data.map((item: SensorData, index: number) => {
const date = new Date(item.createdAt)
// Konversi ke WIB (UTC+7)
const wibDate = new Date(date.getTime() + (7 * 60 * 60 * 1000))
return {
jam: date.getHours(),
jam: wibDate.getUTCHours(),
suhu: item.suhu
}
}).reverse()