1.0.4 • Published 3 years ago

nepali-datepicker-and-dateinput v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Nepali-datepicker-and-dateinput

The aim of this package is to enable user to input nepali date and also select date from nepali calendar from date 1970-01-01 BS to 2099-12-30.

Installation

npm install --save nepali-datepicker-and-dateinput

Calendar-1 Calendar-2

Usage

import NepaliDatepicker from 'nepali-datepicker-and-dateinput';

export Datepicker = () => {

  const handleDateChange = (name, dateInMilli, bsDate, adDate) => {
    console.log(name); // Prints the field name of date input
    console.log(dateInMilli); // Prints the equivalent date millisecond
    console.log(bsDate); // Prints the bsDate
    console.log(adDate); // Prints the equivalent adDate
  }

  return (
    <NepaliDatepicker
      id="nepali-date"
      onChange={handleDateChange}
      label="नेपाली मिति"
      defaultDate="2077-01-01"
      defaultFormat
    />
  );
}

Props

PropsTypeDefault ValueDescription
idstring"nepali-calendar"The identifier of date field . If there are more than one date input in form , then it is required.
labelstring"मिति"Label for date input
showDefaultDateBooleanfalseIf true , today nepali date is shown in date input by default
defaultDateString or LongThis props takes date either in "YYYY-MM-DD" format or directly takes equivalent millisecond
defaultFormatBooleanfalseIf defaultDate props has value in format "YYYY-MM-DD" then this prop should be set as true
disabledBooleanfalseIf date input field needs to be disabled then this props should be set as true
localestring ("ne" or "en")"ne"If "ne" then all text in calendar is shown in nepali else shown in english
inputContainerClassNamestringCan send custom classname for date input field
maxDateErrorMessagestring"२०९९ साल भन्दा बढी मिति समावेश हुने छैन"Error message, shown if date is more then maximal date
minDateErrorMessagestring"१९७० साल भन्दा कम मिति समावेश हुने छैन"Error message, shown if date is less then minimal date
invalidFormatMessagestring"मान्य ढाँचामा नभएको मिति समावेश हुने छैन"Message displaying in text field if date is invalid
invalidDateMessagestring"पात्रोमा नभएको मिति समावेश गरिने छैन"Message displaying in the text field if date is not in the calendar . For example 2077-12-35