npm.io
0.0.10 • Published 3 years ago

react-date-picker-mc

Licence
—
Version
0.0.10
Deps
5
Size
110 kB
Vulns
0
Weekly
0

React Date Picker

A simple and easy to use date picker build with React and dayjs

Static Badge

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

portfolio linkedin

github