score:1

Accepted answer

an option is that you could set that the user should not be able to change the month if the two days are within the same month. you can set which month this is with initial month.

you can then set the disabled days which will be an array of dates which is the days of that month excluding the two available days.

example:

if you use something like this to have a method to get all dates in a month, you could do something like this:

import react from 'react';
import daypicker from 'react-day-picker';
import 'react-day-picker/lib/style.css';

export default function example() {
  const disabledmonth = getdaysinmonth(11, 2017);

  return (
    <daypicker
      initialmonth={new date(2017, 11)}
      disableddays={
        this.disabledmonth.filter(
          (date) => ![new date(2017, 11, 3).tostring(), new date(2017, 11, 13).tostring()].includes(date.tostring())
        )
      }
    />
  );
}

here i am filtering out two dates, the 3rd and 13th of december, which should be available.

this is written with es6


Related Query

More Query from same tag