0

I am using react-date-range plugin to select a date range in a application. It is shown as follows. screen How can I fix this incorrect dates?

I updated the package in the package.json, but that didn't help. Thanks for your help

Rinat
  • 1
  • 1

1 Answers1

0

By follow the documentation we can achieve this, here is an example of the code

import { DateRangePicker } from 'react-date-range';

class MyComponent extends Component {
  handleSelect(ranges){
    console.log(ranges);
    // {
    //   selection: {
    //     startDate: [native Date Object],
    //     endDate: [native Date Object],
    //   }
    // }
  }
  render(){
    const selectionRange = {
      startDate: new Date(),
      endDate: new Date(),
      key: 'selection',
    }
    return (
      <DateRangePicker
        ranges={[selectionRange]}
        onChange={this.handleSelect}
      />
    )
  }
}