From 4c941209be25da651f6712baea8709fb91876fbe Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 7 Nov 2023 15:25:18 +0000 Subject: [PATCH] fix(site/src/api): getDeploymentDAUs: truncate tz_offset to whole number --- site/src/api/api.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/site/src/api/api.ts b/site/src/api/api.ts index 8461c758bf692..7e50291a9b995 100644 --- a/site/src/api/api.ts +++ b/site/src/api/api.ts @@ -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 => { const response = await axios.get(`/api/v2/insights/daus?tz_offset=${offset}`); return response.data;