@kaizer433/react-nepali-datepicker
v1.1.1
Published
React DatePicker for Bikram Sambat(Nepali Official Calendar)
Downloads
46
Maintainers
Readme
React-Nepali-Datepicker
A React DatePicker for Nepali Dates(BS)
Install
npm i @kaizer433/react-nepali-datepicker
Usage
import React, { Component } from 'react'
import DatePicker from '@kaizer433/react-nepali-datepicker'
import '@kaizer433/react-nepali-datepicker/dist/index.css'
class Example extends Component {
defaultDate = '2077-04-12' //default date must be in YYYY-MM-DD format
dateChange = (d) => {
console.log(d)
/** {"bsYear":2077,
* "bsMonth":2,
* "bsDate":15,"weekDay":5,
* "formattedDate":"२०७७ जेठ, १५",
* "adDate":"2020-05-27T18:15:00.000Z",
* "bsMonthFirstAdDate":"2020-05-13T18:15:00.000Z",
* "bsMonthDays":32}
**/
}
render() {
return (
<DatePicker
dateFormat={'%y %M, %d'}
onDateChange={(date) => dateChange(date)}
placeholderText='From Date' //optional
selectedDefaultDate={defaultDate} //optional
fromDate={'2077-03-11'} //optional; if one need to set start date range; should be in YYYY-MM-DD format
toDate={'2077-03-29'} //optional; if one need to set end date range; should be in YYYY-MM-DD format
/>
)
}
}
License
MIT © kaissaroj