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