0.2.0 • Published 12 months ago

@nwleedev/use-calendar v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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

  • CalendarLibs

    • createBeforeDays
    • createAfterDays
    • createMonthDays
    • createYearMonths
    • createDecadeYears
    • createFullDecades
  • DateLibs

    • isYearEqual
    • isMonthEqual
    • isDateEqual
    • isDayEqual
    • createDefaultDate
    • toDecade
    • toCentury

Libraries Used

  • pnpm workspaces
  • tsup
  • changesets
0.2.0

12 months ago

0.1.3

12 months ago

0.1.2

12 months ago

0.1.0

1 year ago