Adjust loadStaffData method to handle timezones accurately in Staff Playtime component.

This commit is contained in:
akastijn 2025-11-02 23:06:12 +01:00
parent 83893f947d
commit 795bd22ee9

View File

@ -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)