samin-datepicker
v1.0.4
Published
Description of your package
Downloads
10
Maintainers
Readme
Samin DatePicker
This package is a Jalaali date picker for React app, with the ability to select several and a period of time (range of time)
Installation
To install samin-datepicker, you will need to have npm or yarn installed on your system. Once you have one of these package managers set up, you can install samin-datepicker by running the following command:
npm install --save samin-datepicker
or
yarn add samin-datepicker
Usage/Examples
This will install the latest version of samin-datepicker and add it as a dependency to your project.
DatePicker
The DatePicker component is a standalone calendar picker that allows the user to select a single date.
import { useState } from "react";
import DatePicker from "samin-datepicker";
import { Moment } from "moment-jalaali";
function App() {
const [date, setDate] = useState<Moment | null>(moment());
return (
<DatePicker
onChange={newDate => {
setDate(newDate);
}}
value={date}
/>
);
}
RangePicker
The RangePicker component is a calendar picker that allows the user to select a range of dates.
import { useState } from "react";
import DatePicker from "samin-datepicker";
import { Moment } from "moment-jalaali";
function App() {
const [range, setRange] = useState<RangeValue>([null, null]);
return (
<DatePicker
range={{
setValue: setRange,
value: range,
}}
/>
);
}
Authors
License
Dedicated
Dedicated to my dear Samin