From 8441c36dfbf3e41f71256d2255049cfb64cd8ce7 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 7 Nov 2023 16:00:00 +0000 Subject: [PATCH] fix(site/src/api): getDeploymentDAUs: truncate tz_offset to whole number (#10563) --- 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 8461c758bf..7e50291a9b 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;