1.2.1 • Published 2 years ago

amin-ahmady-jalali-react-datepicker v1.2.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Jalali React Date-Picker

Build Status All Contributors

🚨 I start to redesigning this package. Here you can see the new artboards that well designed by eanlami. If you want to collabrate for this version feel free to make changes or contact me 😊

alt-text

React component that helps you to makes simple Farsi/Jalali/Shamsi date picker. It also has range date picker you can select multiple days in multiple months.

Installation

$ npm install -S jalali-react-datepicker

Date Picker

propstypedefault
valuetimestamp | Date | MomentDateMomenttoday date
weekendnumber[][6]
ArrowLeftReact.ReactTypedefault component
ArrowLeftReact.ReactTypedefault component
ClockIconReact.ReactTypedefault component
DateIconReact.ReactTypedefault component
timePickerbooleantrue.
onClickSubmitButtonfunctionnull. if you passed this will be something like
modalZIndexnumber9999
themeobjectdefault theme you can see here
labelstringdefault is null
openbooleandefault is false. control opening and close modal from outside
onTogglefunctiondefault is undefined. this function will be called when the modal open and close state is changed

usage

import React from "react";
import { render } from "react-dom";
import { DatePicker } from "jalali-react-datepicker";

render(<DatePicker />, document.getElementById("root"));

onClickSubmitButton

You can access to datePicker value when submit button is clicked.

example:

function submitExample({ value }) {
  console.log("value ", value);
}

Range Date Picker

You can make range date picker with this component. In the below table you can see all the props you can pass to this component.

Note that all props are optional.

propstypedefault
startstring. ex: 1397/5/18today date
endstring. ex: 1397/5/18today date
weekendnumber[][6]
ArrowLeftReact.ReactTypedefault component
ArrowRightReact.ReactTypedefault component
isRenderingButtonsbooleantrue. if it is false rangeDatePicker doesnt show submit and cancel buttons
onClickSubmitButtonfunctionnull. if you passed this will be something like this
modalZIndexnumber9999
themeobjectdefault theme you can see here
fromLabelstringdefault is از تاریخ
toLabelstringdefault is تا تاریخ
openbooleandefault is false. control opening and close modal from outside
onTogglefunctiondefault is undefined. this function will be called when the modal open and close state is changed

usage

import React from "react";
import { render } from "react-dom";
import { RangeDatePicker } from "jalali-react-datepicker";

render(<RangeDatePicker />, document.getElementById("root"));

onClickSubmitButton

You can access to start and end date when submit button is clicked.

example:

function submitExample({ start, end }) {
  console.log("start ", start);
  console.log("end ", end);
}

ToDo

  • write DatePicker
  • add label to inputs
  • create codesandbox page for preview
  • add TimePicker

Contributors

Thanks goes to these wonderful people (emoji key):

Reza Khosroshahi💻 📖 💡 🤔 ⚠️saeedjalali💬 🐛 💻 🤔 👀 📢ZMashhadizadeh💻 📦

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT License