Backend give me data of gantt diagramm start and end points in format:
“horizont_start”: “2024-05-01T00:00:00Z”,
“horizont_end”: “2025-01-26T00:00:00Z”,
Next i give through props to another component Date format of this points like this:
<NewGanttChart
start={
new Date(
gantt?.horizont_start ||
new Date(
new Date().getFullYear(),
0,
1
)
)
}
end={
new Date(
gantt?.horizont_end ||
new Date()
)
}
data={gantt?.machine_types || []}
isTooltip={true}
tooltip={tooltip}
/>
in component i use function to calculate timeAxis intervals:
//also save in store start and end time
useEffect(() => {
dispatch(setStartTime(start?.getTime()))
dispatch(setEndTime(end?.getTime()))
}, [start, end])
const timeAxis = useMemo(() => {
const axisLength = Math.ceil((end - start) / (measure * 60 * 60 * 1000))
const axisDates = new Array(axisLength).fill(0).map((_, i) => {
const date = new Date(start.getTime())
const newDate = new Date(+date + 1000 * 60 * 60 * measure * i)
return newDate.getTime()
})
console.log(axisDates)
return axisDates
}, [end, measure, start])
My main problem is local time, so i want to show start point time 00:00:00, but i got +5h 05:00:00, how to solve this problem?