hypeserver / react-date-range

A React component for choosing dates and date ranges.
MIT License
2.57k stars 658 forks source link

Calendar Month onChange does not trigger on disabledDates #532

Open jaanreinok opened 2 years ago

jaanreinok commented 2 years ago

Subject of the issue

Calendar does not trigger onChange event on disabled days.

[BUG] Bug Reproduce Steps

import React, { Component } from "react";

import { Calendar } from "react-date-range";
import "react-date-range/dist/styles.css"; // main style file
import "react-date-range/dist/theme/default.css"; // theme css file
import "moment/locale/en";

import { en } from "date-fns/locale";

class CalendarBook extends Component {

  render() {
    const onChange =(event)=>{
      console.log("onChange",event)
    }
    return (
      <Calendar
        locale={et}
        date={new Date()}
        disabledDates={this.props.disabledDates.map((d) => new Date(d))}
        onChange={onChange}
      />
    );
  }
}

export default CalendarBook;

[BUG] Expected behaviour

I would expect to have an possibility to read click on disabled dates. This might not be a bug. I couldn't find any setting that would disable that behavior.

Environment

1.4.0 React version: 16.12.0 Node version: 12.18.4 Browser: chrome 95