0.1.9 • Published 10 months ago

nepali-react-datepicker v0.1.9

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

React Nepali Datepicker

Install

npm i nepali-datepicker-react
yarn add nepali-datepicker-react
pnpm i nepali-datepicker-react

Usage

Provider usage

import { useDatePickerStore, selectEvents, selectCtx, disableTogglerAfterMaxEngDate, DatePickerStoreProvider, ModeEnum } from "nepali-datepicker-react";

<DatePickerStoreProvider props={{
        mode: ModeEnum.RANGE,
        closeOnSelect: false,
        startDate: "",
        endDate: "",
        showSecondaryDate: true
    }} >
        <div className="items-start flex flex-col gap-3">
            {...your_component}
        </div>
    </DatePickerStoreProvider>

Hook usage

import { zero_pad, DATE_NULLIFIER, selectCtx, selectEvents, useDatePickerStore } from "nepali-datepicker-react";

export const PickerBody = () => {
    const state = useDatePickerStore();

    const { gridDates, weeks, showSecondaryDate } = selectCtx(state)
    const { selectDay } = selectEvents(state)

    return ...
}

Props

Calendar Props

Prop NameTypeDefaultDescription
startDatestartDate--
endDateendDate
disabledWeekDaysdisabled[]This is the array of week days that is used to disable the week days in the calendar if value is 1,2,3 then sunday, monday and tuesday cells are disabled.
holidaysholidays[]This holds the holidays, based on this cells are disabled
isNepaliisNepalifalseThis is used to determine if the calendar context is in nepali or english.
modemodeModeEnum.SINGLEThis is the mode of the datepicker.
disableDateBeforestring-This is the date before which datepicker should be disabled.
disableDateAfterstring-This is the date after which datepicker should be disabled.
onChange(date: string) => void | undefinedundefinedThis gets triggered when date changes.
onError(date: string) => voidundefinedThis gets triggered when there is an error.
isDisabledbooleanfalseThis is the determine if input should be disabled or not.
isRhfBoundbooleanfalseThis is the determine if input should be bound with rhf or not.
showTogglebooleanfalseDetermine if the is nepali toggle button should be shown or not.
closeOnSelectbooleanfalseDetermine if the picker should be closed on day select.
showSecondaryDatebooleanfalseDetermine if the secondary date should be shown or not.
showRangeMenubooleanfalseDetermine if the is range menu (this week, this month, etc...) should be shown or not.

Roadmap

  • yearly grid view
0.1.9

10 months ago

0.1.8

12 months ago

0.1.7

12 months ago

0.1.6

12 months ago

0.1.5

12 months ago

0.1.4

12 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago