From ab06a7bdf3f4cba4f721ce4df93ab164ae7366e7 Mon Sep 17 00:00:00 2001 From: wireless_purple Date: Thu, 18 Jul 2024 18:04:02 +0000 Subject: [PATCH] fix priceFormat when price is 0 --- src/lib/formatPrice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/formatPrice.js b/src/lib/formatPrice.js index ded7f5f..b91e311 100644 --- a/src/lib/formatPrice.js +++ b/src/lib/formatPrice.js @@ -21,7 +21,7 @@ const getSignificantDigits = (price) => { for (; i < 20; i++) { if (Math.floor(avg * 10 ** i) >= 1000) break; } - if (i <= 1) i = 2; + if (i <= 1 || avg == 0) i = 2; return i; };