From d77e7300c99e9d870f24291f558b8633b1b07d98 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 9 May 2024 16:51:54 +0900 Subject: [PATCH] Remove empty period of '1Y' timeframe in Detail chart --- src/components/DetailChart/ApexChart/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/DetailChart/ApexChart/index.js b/src/components/DetailChart/ApexChart/index.js index 905b9870..5bbeb980 100644 --- a/src/components/DetailChart/ApexChart/index.js +++ b/src/components/DetailChart/ApexChart/index.js @@ -265,7 +265,7 @@ const ApexChart = ({ firstDate, ago - if (range === 'ALL') { + if (range === 'ALL' || range === '1Y') { if (filter === 0) { firstDate = data?.tvls?.length > 0 @@ -284,7 +284,11 @@ const ApexChart = ({ toDate = Math.floor(nowDate.getTime() / 1000), periodDate = (toDate - Number(firstDate)) / (24 * 60 * 60) - ago = Math.ceil(periodDate) + if (range === '1Y' && periodDate > 365) { + ago = getRangeNumber(range) + } else { + ago = Math.ceil(periodDate) + } } else { ago = getRangeNumber(range) }