nepali-datepicker-react
v0.0.2
Published
Integrate Nepali Datepicker in your React app easily.
Downloads
28
Maintainers
Readme
React Nepali Datepicker
Integrate Nepali Datepicker in your React app easily.
Installation
- Install by executing
npm i nepali-datepicker-react
oryarn add nepali-datepicker-react
. - Import by adding
import { NepaliDatePicker } from 'nepali-datepicker-react'
.
Demo Link
https://codesandbox.io/s/nepali-date-picker-0f3d1
Props
Common props you may want to specify include:
className
- apply a className to the controlclassNameInput
- apply classNames to input fieldname
- generate an HTML input with this name, containing the current valueonChange
- change eventsplaceholder
- change the text displayed when no date is definedvalue
- control the current valueformat
- change the date format i.e.('YYYY-MM-DD' && 'YYYY/MM/DD') only
Usage
Here's an example of basic usage:
import React, { useState } from 'react';
import { NepaliDatePicker, BSDate } from 'nepali-datepicker-react';
const now = new BSDate.now();
function MyApp() {
const [date, setDate] = useState(now);
const handleDate = date => {
setDate(date);
console.log('Date',date);
}
return (
<NepaliDatePicker
value={date}
format="YYYY-MM-DD"
onChange={handleDate}
/>
);
}