React-Calendar

Install
npm install ciqu-react-calendar --save
Example
import React from 'react'
import ReactDom from 'react-dom'
import moment from 'moment'
import Calendar from 'ciqu-react-calendar'
class MyCalendar extends React.Component {
constructor(props) {
super(props)
}
onChange = (value, inputValue) => {
console.log(value.format('YYYY-MM-DD'))
this.setState({value})
}
onOpenChange = (status) => {
console.log('open status: ' + status)
}
disabledDate = (currentDate, inputValue) => {
return false
}
render() {
const {onChange, onOpenChange, disabledDate} = this
return <div style={{
width: 400,
margin: '200px auto'
}}>
<Calendar
onChange={onChange}
allowClear={true}
disabled={false}
placeholder={'please input date'}
format={'YYYY-MM-DD'}
defaultValue={moment()}
onOpenChange={onOpenChange}
disabledDate={disabledDate}
/>
</div>
}
}
ReactDom.render(
<MyCalendar/>,
document.getElementById('el')
)
API
interface CalendarProps {
onChange?(value?: Moment, inputValue?: string): void
onOpenChange?(status?: boolean): void
disabledDate?(currentDate: Moment, inputValue: string): boolean
allowClear?: boolean
disabled?: boolean
open?: boolean,
placeholder?: string
format?: string
className?: string
value?: Moment
defaultValue?: Moment
}
License
MIT