From 2230f42ac18ac719fdc82a4454185fecd21d996c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3za=20Nagy?= Date: Mon, 4 Nov 2024 20:33:27 +0100 Subject: [PATCH] feat: add condition to format function --- src/shared/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/utils.ts b/src/shared/utils.ts index ad7f592b..0b53ae2e 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -52,7 +52,8 @@ export function formatEvent(event: DetailedEvent): FormattedEvent { } export function formatToThreeDecimals(value: number): number { - return parseFloat(value.toFixed(3)); + const formattedValue = parseFloat(value.toFixed(3)); + return formattedValue === 0 ? 0 : formattedValue; } export const breakpoints = ['300px', '400px', '600px', '850px', '1280px', '1400px'];