Made with create-react-library
npm install --save datepicker-jalali-react
https://matinrezakhani.github.io/datepicker-jalali-react/
props | type | default |
---|---|---|
value | timestamp | Date | Moment | Date |
locale | string ('fa','en') | fa |
disableDate | boolean | default is false |
disableTime | boolean | default is false |
onChange | function | this function will be called when the date or time changed |
import React, { useState } from 'react'
import Datepicker from 'datepicker-jalali-react'
const App = () => {
const [date, setDate] = useState('')
const handleDatepicker = (e) => {
console.log(e)
setDate(e)
}
return (
<div>
<Datepicker
value={date}
onChange={(e) => {
handleDatepicker(e)
}}
/>
<Datepicker
value={date}
disableTime
onChange={(e) => {
handleDatepicker(e)
}}
/>
<Datepicker
value={date}
disableDate
onChange={(e) => {
handleDatepicker(e)
}}
/>
</div>
)
}
MIT © matinrezakhani