rsuite datePicker minDate and maxDate not working
I want to set minDate and maxDate in rsuite. but its not working. Plz anyone help me fix it
Code Sandbox Link: https://codesandbox.io/p/sandbox/relaxed-star-jwdd5d?file=%2Findex.js%3A11%2C35
code:
import React from "react";
import ReactDOM from "react-dom";
import "rsuite/dist/rsuite.min.css"; // Import default styles for rsuite
import "./styles.css"; // Make sure this file exists and contains your custom styles
import { DatePicker, Stack } from "rsuite";
const App = () => {
const currentDate = new Date();
const minDate = new Date(
currentDate.getFullYear() - 1,
currentDate.getMonth(),
currentDate.getDate()
);
return (
<Stack direction="column" alignItems="flex-start" spacing={6}>
<DatePicker format="MM/dd/yyyy" minDate={minDate} maxDate={currentDate} />
</Stack>
);
};
ReactDOM.render(<App />, document.getElementById("root"));
2 Replies
no familiar with react datepicker, but it has to do with the min and max props not being recognized
ya.. I think rsuite datepicker doesn't has this support.
I have come up with a different solution. Hope this helps someone in the future.🙂
CodeSandbox Link: https://codesandbox.io/p/sandbox/rsuite-date-picker-jwdd5d?file=%2Findex.js%3A13%2C1