React-day-picker: DayPickerInput does not have disabledDays functionality

Created on 17 Nov 2017  路  9Comments  路  Source: gpbl/react-day-picker

disabledDays functionality is allows in DayPicker, but not DayPickerInput. I took a look at the source and I would guess that the disabledDays functionality should be in DayPickerInput - maybe there's a bug? I was able to reproduce in codesandbox.

Around line 158 of DayPickerInput.js makes me think the functionality should exist...

        var modifiersObj = _extends({
          disabled: dayPickerProps.disabledDays,
          selected: dayPickerProps.selectedDays
        }, dayPickerProps.modifiers);

Below is my code snippet I put in codesandbox - I was able to reproduce the issue there.

import React from "react";
import ReactDOM from "react-dom";

import DayPicker from "react-day-picker";
import DayPickerInput from "react-day-picker/DayPickerInput";

import "react-day-picker/lib/style.css";

function Example() {
  const disabledDays = {
    daysOfWeek: [0, 6],
  };

  return (
    <div>
      <h3>DayPicker</h3>
      <DayPicker selectedDays={new Date()} disabledDays={disabledDays} />

      <h3>DayPickerInput</h3>
      <DayPickerInput placeholder="DD/MM/YYYY" format="DD/MM/YYYY" disabledDays={disabledDays} />
    </div>
  );
}

ReactDOM.render(<Example />, document.getElementById("root"));

screen shot 2017-11-17 at 1 26 52 pm

Most helpful comment

disabledDays works for me with DayPicker but not with DayPickerInput on version 7.2.4
after: new Date(2018, 8, 19)??

All 9 comments

Yup! It will be fixed with the next release: https://github.com/gpbl/react-day-picker/pull/531

@gpbl Thank you so much! I'm going to close this in a few minutes. Do you happen to know when the planned next release is?

It's pending. Release in the next few days 馃檹

Published in v7 馃槉

Has there been a regression here? disabledDays works for me with DayPicker but not with DayPickerInput on version 7.2.1.

@ajbeaven this example uses disabledDays: http://react-day-picker.js.org/examples/input-state

Ahh missed that it needs to be supplied in a datePickerProps object. I guess the API has changed since this issue was created. Thanks for putting me right :)

True! Sorry I missed the original example was wrong :)

disabledDays works for me with DayPicker but not with DayPickerInput on version 7.2.4
after: new Date(2018, 8, 19)??

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brpontes picture brpontes  路  6Comments

leiit picture leiit  路  6Comments

dreamyguy picture dreamyguy  路  5Comments

NikitaSasin picture NikitaSasin  路  5Comments

thebuilder picture thebuilder  路  3Comments