fix(site/src/api): getDeploymentDAUs: truncate tz_offset to whole number (#10563)

This commit is contained in:
Cian Johnston
2023-11-07 16:00:00 +00:00
committed by GitHub
parent 651d14ea68
commit 8441c36dfb
+4 -2
View File
@@ -933,8 +933,10 @@ export const getTemplateDAUs = async (
};
export const getDeploymentDAUs = async (
// Default to user's local timezone
offset = new Date().getTimezoneOffset() / 60,
// Default to user's local timezone.
// As /api/v2/insights/daus only accepts whole-number values for tz_offset
// we truncate the tz offset down to the closest hour.
offset = Math.trunc(new Date().getTimezoneOffset() / 60),
): Promise<TypesGen.DAUsResponse> => {
const response = await axios.get(`/api/v2/insights/daus?tz_offset=${offset}`);
return response.data;