date parser
This commit is contained in:
parent
eba5f3c346
commit
66575f38e7
|
|
@ -10,6 +10,7 @@ import {
|
|||
} from "chart.js";
|
||||
import { Api } from "../helpers/api";
|
||||
import { useState, useEffect } from "react";
|
||||
import { parseDate } from "../helpers/functions";
|
||||
|
||||
ChartJS.register(
|
||||
LineElement,
|
||||
|
|
@ -37,7 +38,7 @@ const LineChart = ({ activeRow, tabIndex }) => {
|
|||
const data = {
|
||||
labels: dataLineChart
|
||||
? dataLineChart.data[activeRow].all_prices.map((price) =>
|
||||
price.date.split(" ")[0].replace("-", ".").replace("-", ".")
|
||||
parseDate(price.date)
|
||||
)
|
||||
: [""],
|
||||
|
||||
|
|
|
|||
|
|
@ -4,3 +4,7 @@
|
|||
export const dateReverse = (date) => {
|
||||
return date.split("-").reverse().join(".");
|
||||
};
|
||||
|
||||
export const parseDate = (date) => {
|
||||
return date.split(" ")[0].split("-").reverse().join(".");
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue