diff --git a/sections/stats/charts/Traders.tsx b/sections/stats/charts/Traders.tsx index 9b5bd7e684..8c335457ab 100644 --- a/sections/stats/charts/Traders.tsx +++ b/sections/stats/charts/Traders.tsx @@ -4,7 +4,7 @@ import { useTheme } from 'styled-components'; import { MiniLoader } from 'components/Loader'; import useStatsData from 'hooks/useStatsData'; -import { formatShortDate, toJSTimestamp } from 'utils/formatters/date'; +import { formatShortDateUTC, toJSTimestamp } from 'utils/formatters/date'; import { initChart } from '../initChart'; import type { EChartsOption } from '../initChart'; @@ -37,7 +37,7 @@ export const Traders = () => { xAxis: { ...defaultOptions.xAxis, type: 'category', - data: dailyStatsData.map(({ timestamp }) => formatShortDate(toJSTimestamp(timestamp))), + data: dailyStatsData.map(({ timestamp }) => formatShortDateUTC(toJSTimestamp(timestamp))), }, yAxis: [ { diff --git a/sections/stats/charts/Trades.tsx b/sections/stats/charts/Trades.tsx index cb96c35ec5..9b91578e1f 100644 --- a/sections/stats/charts/Trades.tsx +++ b/sections/stats/charts/Trades.tsx @@ -4,7 +4,7 @@ import { useTheme } from 'styled-components'; import { MiniLoader } from 'components/Loader'; import useStatsData from 'hooks/useStatsData'; -import { formatShortDate, toJSTimestamp } from 'utils/formatters/date'; +import { formatShortDateUTC, toJSTimestamp } from 'utils/formatters/date'; import { initChart } from '../initChart'; import type { EChartsOption } from '../initChart'; @@ -37,7 +37,7 @@ export const Trades = () => { xAxis: { ...defaultOptions.xAxis, type: 'category', - data: dailyStatsData.map(({ timestamp }) => formatShortDate(toJSTimestamp(timestamp))), + data: dailyStatsData.map(({ timestamp }) => formatShortDateUTC(toJSTimestamp(timestamp))), }, yAxis: [ { diff --git a/sections/stats/charts/Volume.tsx b/sections/stats/charts/Volume.tsx index 83dfaeb1bb..6dfbe73eb9 100644 --- a/sections/stats/charts/Volume.tsx +++ b/sections/stats/charts/Volume.tsx @@ -5,7 +5,7 @@ import { useTheme } from 'styled-components'; import { MiniLoader } from 'components/Loader'; import useStatsData from 'hooks/useStatsData'; -import { formatShortDate, toJSTimestamp } from 'utils/formatters/date'; +import { formatShortDateUTC, toJSTimestamp } from 'utils/formatters/date'; import { formatDollars } from 'utils/formatters/number'; import { initChart } from '../initChart'; @@ -44,7 +44,7 @@ export const Volume = () => { xAxis: { ...defaultOptions.xAxis, type: 'category', - data: dailyStatsData.map(({ timestamp }) => formatShortDate(toJSTimestamp(timestamp))), + data: dailyStatsData.map(({ timestamp }) => formatShortDateUTC(toJSTimestamp(timestamp))), }, yAxis: [ { diff --git a/utils/formatters/date.ts b/utils/formatters/date.ts index 038336ca16..971dbbdb30 100644 --- a/utils/formatters/date.ts +++ b/utils/formatters/date.ts @@ -14,6 +14,11 @@ export const toJSTimestamp = (timestamp: number) => timestamp * 1000; export const formatShortDate = (date: Date | number) => formatDate(date, 'yyyy-MM-dd'); +export const formatShortDateUTC = (date: Date | number) => { + const dateString = new Date(date).toISOString(); + return dateString.substring(0, 10); +}; + export const formatShortDateWithTime = (date: Date | number) => formatDate(date, 'MMM d, yyyy H:mma'); export const formatDateWithTime = (date: Date | number) => formatDate(date, 'd MMM yyyy H:mm');