A cool datepicker for english and persian you can see some features here :
- You can choosing between 5 colors.
- Dark mode and Light mode
- Show loading... and you can change it to whatever you want :)
- You can use any input component for this datepicker
- You can set event for days and make them different vs normal days
- Change your input format
- Disable some date
- Set your custom footer for datepicker
- Auto adjust position
- Calendar
๐ If you like this Datepicker, please bookmark it on your github with the star button.
Use the package manager npm to install @ijavad805/react-datepicker.
npm install @ijavad805/react-datepicker
import { Datepicker } from '@ijavad805/react-datepicker';
// simple
function AppSimple() {
return <Datepicker />;
}
// full options
function App() {
return (
<Datepicker
footer={(moment, setValue) => {
return (
<>
<div
onClick={() => {
if (setValue) setValue(moment());
}}
>
Today
</div>
</>
);
}}
closeWhenSelectADay={true} // boolean
dayEffects={[
{
day: '2022-09-12',
color: 'red',
dotColor: 'red',
title: 'What ever you want',
},
]}
disabled={false} // disable input
disabledDate={(day) => day === moment()} // today should be disabled
format={'YYYY-MM-DD'}
input={<input placeholder="Select a date" />} // whatever you want
onOpen={() => {
console.log('datepicker is open');
}}
lang={'en'} // en and fa
loading={false} // show loading in datepicker if is open
modeTheme={'dark'} // dark and light
theme={'blue'} // blue , orange , red , green , yellow
defaultValue={moment()}
adjustPosition={'auto'} // auto, right-top, left-top, right-bottom, left-bottom, modal
onChange={(val: any) => {
console.log(val.format());
}}
/>
);
}
The first version of the calendar is ready but it is just v1 and, yes, it may have some bugs. Please report bugs. I will fix it. I am working on design in v2. You will see a beautiful calendar.
const App = () => {
return (
<Calendar
lang = "en"
theme = "blue"
events={[
{
id: 1, // it should unique
title: "Test",
date: "2022-12-27",
style: {
// what ever you want
}
className: "test",
dotColor: "#000",
disabled: false,
icon: "$", // also you can use component
}
]}
onDropEvent={(item: IEvent) => {
console.log(item);
}}
onClickEvent={(item: IEvent) => console.log(item)}
onDoubleClickEvent={(item: IEvent) => console.log(item)}
style={{
height: 600
}}
onDateClick={(date: moment.Moment) => console.log(date)}
/>
)
}
This is my todo list for feature :
- Range picker
- Calender new ui
My friend, if you see any bugs, please tell me:
- Email: [email protected]
- Github issues: https://github.com/ijavad805/react-datepicker/issues