0.0.10 • Published 10 months ago
react-date-picker-mc v0.0.10
React Date Picker
A simple and easy to use date picker build with React and dayjs
Features
- Display a calendar
- Select date
- Change month and year quickly with selector
Installation
To install, you can use npm or yarn:
$ npm install react-date-picker-mc
$ yarn add react-date-picker-mc
⚠️ These component needs to receive a dayjs date object
$ npm install daysjs
$ yarn add daysjs
Usage
The component needs two props:
Props | Types | Required | Default | Description |
---|---|---|---|---|
isOpen | Bool | ✅ | Boolean that indicates if the calendat tootip should be open or not | |
setIsOpen | function | ✅ | change the state of isOpen | |
date | Object | ✅ | A dayjs date object | |
setDate | function | ✅ | change the state of date |
import { Datepicker } from 'react-date-picker-mc'
import "react-date-picker-mc/dist/style.css"
import dayjs from "dayjs";
import weekday from 'dayjs/plugin/weekday'
dayjs.extend(weekday)
function App() {
const [date, setDate] = useState(dayjs())
const [calendarIsOpen, setCalendarIsOpen] = useState(false)
return (
<div className="App">
<Datepicker isOpen={calendarIsOpen} setIsOpen={setCalendarIsOpen} selectedDate={date} setSelectedDate={setDate} />
</div>
)
}
export default App