Updated frontend call to include local timezone

This commit is contained in:
alexjanousekGSA
2025-01-30 17:24:29 -05:00
parent dafe86aad6
commit c844b9981b
3 changed files with 15 additions and 4 deletions

View File

@@ -201,15 +201,22 @@
return;
}
var url = type === 'service' ? `/daily_stats.json` : `/daily_stats_by_user.json`;
// get local timezone
var userTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
var url = type === 'service'
? `/daily_stats.json?timezone=${encodeURIComponent(userTimezone)}`
: `/daily_stats_by_user.json`;
return fetch(url)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
console.log(response)
return response.json();
})
.then(data => {
console.log(data)
labels = [];
deliveredData = [];
failedData = [];