From c6102b9208ac2e10c62bc8f56e0ea318cbf4bcef Mon Sep 17 00:00:00 2001 From: Kevin Karch Date: Fri, 17 Jan 2025 15:17:47 -0500 Subject: [PATCH] lint fix --- .../components/TimeSeriesChart.tsx | 37 +++++++------------ 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/datahub-web-react/src/app/analyticsDashboard/components/TimeSeriesChart.tsx b/datahub-web-react/src/app/analyticsDashboard/components/TimeSeriesChart.tsx index 3248223eedd1b..6243f611888d5 100644 --- a/datahub-web-react/src/app/analyticsDashboard/components/TimeSeriesChart.tsx +++ b/datahub-web-react/src/app/analyticsDashboard/components/TimeSeriesChart.tsx @@ -88,26 +88,20 @@ const formatAxisDate = (value: number, chartData: TimeSeriesChartType) => { const date = new Date(value); // force UTC - const utcDate = new Date( - Date.UTC( - date.getUTCFullYear(), - date.getUTCMonth(), - date.getUTCDate() - ) - ); - + const utcDate = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate())); + return chartData.interval === 'MONTH' - ? utcDate.toLocaleDateString('en-US', { - month: 'short', - year: 'numeric', - timeZone: 'UTC' - }) - : utcDate.toLocaleDateString('en-US', { - year: 'numeric', - month: 'short', - day: 'numeric', - timeZone: 'UTC' - }); + ? utcDate.toLocaleDateString('en-US', { + month: 'short', + year: 'numeric', + timeZone: 'UTC', + }) + : utcDate.toLocaleDateString('en-US', { + year: 'numeric', + month: 'short', + day: 'numeric', + timeZone: 'UTC', + }); }; export const TimeSeriesChart = ({ @@ -178,10 +172,7 @@ export const TimeSeriesChart = ({ tooltipData?.nearestDatum && (
- {formatAxisDate( - accessors.xAccessor(tooltipData.nearestDatum.datum), - chartData - )} + {formatAxisDate(accessors.xAccessor(tooltipData.nearestDatum.datum), chartData)}
{accessors.yAccessor(tooltipData.nearestDatum.datum)}