@davidfengau/date-picker
v1.0.9
Published
React Date Picker initially built for use in BGL SF360.
Downloads
4
Readme
@davidfengau/date-picker
React Date Picker initially built for use in BGL SF360.
Installation and usage
yarn add @davidfengau/date-picker
Then use it in your app:
import React from 'react'
import moment from 'moment'
import DatePicker from '@davidfengau/date-picker'
class App extends React.Component {
constructor(props) {
super(props)
this.state = {
startDate: moment()
}
this.handleChange = this.handleChange.bind(this)
}
handleChange(date) {
this.setState({
startDate: date
})
}
render() {
return (
<DatePicker
onChange={this.handleChange}
selected={this.state.Date}
className="form-control"
/>
)
}
}
Use Date Range Picker:
import { DateRangePicker } from '@davidfengau/date-picker'
Props
Common props you may want to specify include:
onChange
- subscribe to date changeselected
- control the current valuetabIndex
- specify the tab indexclassName
- apply a className to the componentminDate
- Min Date allowed to selectmaxDate
- Max Date allowed to selectplaceholderText
- stringallowSameDay
- booleanshowYearDropdown
- boolean
Extra props for date range picker:
onChange
- subscribe to date changeselectsStart
- booleanselectsEnd
- booleanstartDate
- momentendDate
- momentstartDatePlaceholder
- stringendDatePlaceholder
- stringshowClearAll
- boolean
Development
yarn install
yarn run build
Publish
# For public npm
npm publish --access public
# For BGL only
npm publish --registry http://repo.bglcorp.com.au:8081/content/repositories/bgl.npm/