0.2.0 • Published 12 months ago
@nwleedev/use-calendar v0.2.0
Usage
useCalendar
You can display & update states with this hook above.
import useCalendar from "@nwleedev/use-calendar"
const now = new Date()
export default function App() {
const {date, months onMonthChange, onYearChange} = useCalendar({
defaultValue: now
})
}useCalendarContext
You can share calendar states in deeply nested components.
- You must wrap your components with
CalendarProvider
import {
useCalendarContext,
useCalendar,
CalendarProvider
} from '@nwleedev/use-calendar'
export default function App() {
const methods = useCalendar()
return (
<CalendarProvider value={methods}>
<NestedCalendar />
</CalendarProvider>
)
}libs/*
You can use helper methods to get calendar values
CalendarLibscreateBeforeDayscreateAfterDayscreateMonthDayscreateYearMonthscreateDecadeYearscreateFullDecades
DateLibsisYearEqualisMonthEqualisDateEqualisDayEqualcreateDefaultDatetoDecadetoCentury
Libraries Used
- pnpm workspaces
- tsup
- changesets