From 795bd22ee9c7973e9ca80229421e65ec5ed22eef Mon Sep 17 00:00:00 2001 From: akastijn Date: Sun, 2 Nov 2025 23:06:12 +0100 Subject: [PATCH] Adjust `loadStaffData` method to handle timezones accurately in Staff Playtime component. --- .../src/app/pages/head-mod/staff-pt/staff-pt.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/pages/head-mod/staff-pt/staff-pt.component.ts b/frontend/src/app/pages/head-mod/staff-pt/staff-pt.component.ts index 03d919b..30cbb3e 100644 --- a/frontend/src/app/pages/head-mod/staff-pt/staff-pt.component.ts +++ b/frontend/src/app/pages/head-mod/staff-pt/staff-pt.component.ts @@ -87,7 +87,10 @@ export class StaffPtComponent implements OnInit { } private loadStaffData(from: Date, to: Date) { - this.siteService.getStaffPlaytime(from.toISOString(), to.toISOString()) + const fromUtc = new Date(from.getTime() - from.getTimezoneOffset() * 60000); + const toUtc = new Date(to.getTime() - to.getTimezoneOffset() * 60000); + + this.siteService.getStaffPlaytime(fromUtc.toISOString(), toUtc.toISOString()) .subscribe({ next: data => this.staffPt.set(data ?? []), error: err => console.error('Error getting staff playtime:', err)