use-cal
v1.1.2
Published
Simple calendar logic for React
Downloads
21
Maintainers
Readme
useCalendar
Simple calendar logic for React.
Installation
npm i use-cal
useCalendar
was designed to work with the date management library of your choice.
npm i @date-io/date-fns date-fns
// or
npm i @date-io/moment moment
// or
npm i @date-io/luxon luxon
// or
npm i @date-io/dayjs dayjs
Usage
import useCalendar from "use-cal";
import DateFnsAdapter from "@date-io/date-fns";
import locale from "date-fns/locale/en-GB";
const { date, month, weekdays, days, navigatePrev, navigateNext } = useCalendar<
Date
>({
dateUtils: new DateFnsAdapter({ locale }),
// Optionally set the initial date value of the calendar. Defaults to today.
defaultDate: new Date(),
});