Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8441c36

Browse files
authored
fix(site/src/api): getDeploymentDAUs: truncate tz_offset to whole number (coder#10563)
1 parent 651d14e commit 8441c36

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

site/src/api/api.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -933,8 +933,10 @@ export const getTemplateDAUs = async (
933933
};
934934

935935
export const getDeploymentDAUs = async (
936-
// Default to user's local timezone
937-
offset = new Date().getTimezoneOffset() / 60,
936+
// Default to user's local timezone.
937+
// As /api/v2/insights/daus only accepts whole-number values for tz_offset
938+
// we truncate the tz offset down to the closest hour.
939+
offset = Math.trunc(new Date().getTimezoneOffset() / 60),
938940
): Promise<TypesGen.DAUsResponse> => {
939941
const response = await axios.get(`/api/v2/insights/daus?tz_offset=${offset}`);
940942
return response.data;

0 commit comments

Comments
 (0)