nepali-date-picker-axiossoftwork
v1.0.5
Published
A simple nepali date picker for axiossoftwork products and projects
Downloads
16
Readme
NepDatePicker
The NepDatePicker
component is a simple date picker application designed for selecting Nepali dates. It provides various customization options and callback functions to handle date selection and other interactions.
Installation
To install the package, you can use npm or yarn:
npm install nepali-date-picker-axiossoftwork
# or
yarn add nepali-date-picker-axiossoftwork
## Usage
Here is a basic example of how to use the `NepDatePicker` in your project:
import React, { useState } from 'react';
import NepDatePicker from 'nepali-date-picker-axiossoftwork';
const App = () => {
const [selectedNepaliDate, setSelectedNepaliDate] = useState(null);
const handleDayIdSelect = (dayId) => {
console.log('Selected date token:', dayId);
};
const handleDateSelect = (date) => {
setSelectedNepaliDate(date);
console.log('Selected Nepali date:', date);
};
return (
<div>
<h1>Select a Nepali Date</h1>
<NepDatePicker
onDateSelect={handleDateSelect}
onDayIdSelect={handleDayIdSelect}
/>
{selectedNepaliDate && <p>Selected Nepali Date: {selectedNepaliDate}</p>}
</div>
);
};
export default App;
Props
The NepDatePicker
component accepts the following props:
- currentDate (
boolean
): Flag to select today's date. - defaultDate (
boolean
): Flag to select default date provided. - activeColor (
string
): The active color to be used. - defaultColor (
boolean
): Flag to use the default color. - onDateSelect
(date: string) => void
: Callback function that returns the selected Nepali date. - onDayIdSelect
(dayId: string) => void
: Callback function that returns the date token when a date is selected. - reset (
boolean
): Flag to reset the date picker.