Skip to content

Bug or Feature? Adding onChange breaks the multiple functionality on blur (only happens when today's date is picked) #349

@umrashrf

Description

@umrashrf

Steps to reproduce:

  1. Create a new empty react project
  2. Install react-multi-date-picker
  3. Copy the following code
import { useState } from "react";

import DatePicker from "react-multi-date-picker"

import './App.css';

function App() {
  const [dates, setDates] = useState(null);

  return (
    <div className="App">
      <h1>DatePicker Testing</h1>
      <DatePicker
        multiple={true}
        value={dates}
        minDate={new Date()}
        highlightToday={false}
        placeholder="Select date"
        onChange={dates => {
          setDates(dates);
        }}
      />
    </div>
  );
}

export default App;
  1. Pick today's date from the calendar
  2. Pick a few future dates
    Image
  3. Click anywhere on page to hide the calendar
  4. Notice the date picked is only today's date
    Image
  5. Remove onChange handle and it works fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions