Adjust loadStaffData method to handle timezones accurately in Staff Playtime component.
This commit is contained in:
parent
83893f947d
commit
795bd22ee9
|
|
@ -87,7 +87,10 @@ export class StaffPtComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadStaffData(from: Date, to: Date) {
|
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({
|
.subscribe({
|
||||||
next: data => this.staffPt.set(data ?? []),
|
next: data => this.staffPt.set(data ?? []),
|
||||||
error: err => console.error('Error getting staff playtime:', err)
|
error: err => console.error('Error getting staff playtime:', err)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user