在反应甘特图时间轴中突出显示当前日期

Highlight current date in react Gantt timeline

我正在使用 react-gantt timeline 包,我不知道如何在 react gant timeline 中指示当前日期。 我正在寻找一个垂直条来做同样的事情。

您可以定义自定义时间轴标记

import Timeline, {
  TimelineMarkers,
  CustomMarker,
  TodayMarker,
  CursorMarker
} from 'react-calendar-timeline'

<Timeline>
  <TimelineMarkers>
    <TodayMarker />
    <CustomMarker date={Date.now()} />
    <CustomMarker date={tomorrow}>
      {/* custom renderer for this marker */}
      {({ styles, date }) => {
        const customStyles = {
          ...styles,
          backgroundColor: 'deeppink',
          width: '4px'
        }
        return <div style={customStyles} onClick={someCustomHandler} />
      }}
    </CustomMarker>
    <CursorMarker />
  </TimelineMarkers>
</Timeline>