1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

datepicker

This commit is contained in:
Jernej Pregelj 2019-04-05 16:14:26 +02:00
parent a1ab653ffb
commit 2dedbc19e0

View File

@ -23,6 +23,7 @@ interface InputProps {
value?: string
onChange?(
event:
| any
| FormEvent<HTMLInputElement>
| ChangeEvent<HTMLInputElement>
| ChangeEvent<HTMLSelectElement>
@ -39,6 +40,7 @@ interface InputState {
}
export default class Input extends PureComponent<InputProps, InputState> {
hiddenDate: any
public state: InputState = {
isFocused: false,
startDate: new Date()
@ -64,6 +66,13 @@ export default class Input extends PureComponent<InputProps, InputState> {
this.setState({
startDate: date
})
const event = {
currentTarget: {
name: 'startDate',
value: date
}
}
this.props.onChange!(event as any)
}
public InputComponent = () => {
@ -157,7 +166,6 @@ export default class Input extends PureComponent<InputProps, InputState> {
<div className={wrapClass}>
<DatePicker
selected={this.state.startDate}
// TODO: this needs to be able to receive this.props.onChange too
onChange={this.handleDateChange}
className={styles.input}
onFocus={this.toggleFocus}