Use datetime helpers instead of direct date-fns import

This commit is contained in:
Matthias 2024-04-10 07:08:25 +02:00
parent dbccd30ec6
commit 4a067daba5

View File

@ -16,7 +16,6 @@ import {
PlotConfig,
Trade,
} from '@/types';
import { format } from 'date-fns-tz';
import ECharts from 'vue-echarts';
@ -44,6 +43,7 @@ import {
} from 'echarts/components';
import { use } from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers';
import { timestampms } from '@/shared/formatters';
use([
AxisPointerComponent,
@ -645,15 +645,11 @@ function initializeChartOptions() {
function updateSliderPosition() {
if (!props.sliderPosition) return;
const start = format(
props.sliderPosition.startValue - props.dataset.timeframe_ms * 40,
'yyyy-MM-dd HH:mm:ss',
);
const end = format(
const start = timestampms(props.sliderPosition.startValue - props.dataset.timeframe_ms * 40);
const end = timestampms(
props.sliderPosition.endValue
? props.sliderPosition.endValue + props.dataset.timeframe_ms * 40
: props.sliderPosition.startValue + props.dataset.timeframe_ms * 80,
'yyyy-MM-dd HH:mm:ss',
);
if (candleChart.value) {
candleChart.value.dispatchAction({