ant-design RangePicker time selection box default value setting processing

1.
Basics, go directly to the code without too much explanation


// 做这个处理是为了避免出现invalid date
 const lastStart =
      deepStartDate === '' || deepStartDate === undefined ? deepStartDate : moment(deepStartDate);
    const lastEnd =
      deepEndDate === '' || deepEndDate === undefined ? deepEndDate : moment(deepEndDate);

  <RangePicker
              value={
    
    [lastStart, lastEnd]}
              onChange={
    
    this.handleDateChange.bind(this)}
              style={
    
    {
    
     width: 230, marginLeft: 20 }}
            />

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45416217/article/details/114179880