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
Source: stackoverflow.com
Related Query
- how to enable two day only in react-day-picker
- calendar Ant Design: how to show event only in specific day in month using React JS
- How to style the day button in react material-ui date picker
- React Day Picker only changing "to" state on second click
- React day picker return all data when expecting only day
- React Date Picker - How to handle if user only selects the start date in range and does not selects the end date?
- How to specify handleDayClick of React Day Picker component of a functional component
- How to call loading function with React useEffect only once
- How to make a shared state between two react components?
- React - how to capture only parent's onClick event and not children
- How to create two columns with space beetwen in react native - flatList
- How to import component in react native past two folders?
- How to allow only numbers in textbox and format as US mobile number format in react js? ex : (224) - 5623 -2365
- Using React Router and Webpack 2 how to require external libraries only on certain routes?
- How to show results of a map in two or more columns using react
- How to load the google maps api <script> in my react app only when it is required?
- React Router + iis? How to enable routing
- React CSS - how to apply CSS to specific pages only
- How to enable the Android monitor in React Native for checking logs?
- How do I enable touch on multiple buttons simultaneously in react native?
- how to add two onClick functions in React
- How to make React input onChange set state only after onChange stops firing for set time?
- How to enable absolute path aliases with eslint import plugin in a typescript react project?
- How to make a React component fade in on scroll using IntersectionObserver, but only once?
- How to set Two inputs on same row in react native ?
- how to add react jsx as javascript file type in vim and enable eslinting, auto completions?
- How do I fix "Cannot assign to read only property 'style' of object" in this React component?
- How to render React components only once on startup?
- VSCode provides intellisense for Foo.js via a corresponding Foo.d.ts only when it’s imported somewhere; how to enable intellisense in a Foo.js itself?
- How to enable prop-types in production for a React Storybook for the Docs addon
More Query from same tag
- this.context empty object when using react-redux
- React loses props inside array
- i18next not detecting language variation, eg: en-us
- Removing icon when there are no children
- Creating Sudoku in React
- Next-Auth user object in session is returning null for its values
- Jest and Enzyme unit test: TypeError: Cannot read property 'push' of undefined
- how could I specify a type for a react component in typescript?
- Page does not refresh automatically after DELETE and UPDATE item on the lists. React-Redux
- React Relay Modern redirecting to another page when receiving 401 error on network environment
- Put title on 2 lines when screen gets too small
- Attempted import error: 'createNote' is not exported from './graphql/mutations' (imported as 'createNoteMutation')
- why toUpperCase not working in nextjs while adding slug
- locahost returns ERR_CONNECTION_REFUSED on React component edit
- Passing data back to prop from Axios with ReactJS Rails 6
- How to access data within map function for onClick in react
- thinking in react with different example?
- How to add event listener in React?
- React Hooks : mapping data from api call to render pie chart
- Google chrome logs indicating xml.js:30 instead of actual line
- React: missing dependency warning within interval in effect
- setTimeout callback called twice in React functional component?
- How to use material UI default components
- Antd Menu - React Js
- useEffect doesn't wait Promise.all?
- TypeError: Cannot read properties of undefined (reading 'anwsers')
- React how to return a variable so that it renders without giving an error of undefined
- Matrix class from jsPDF is inaccessible in React
- React json array not rendered
- Switching between components in React JS