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

Merge pull request #70 from oceanprotocol/datepicker

fix dateCreated
This commit is contained in:
Matthias Kretschmann 2019-04-05 17:15:33 +02:00 committed by GitHub
commit e01c258c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,13 +35,13 @@ interface InputProps {
interface InputState {
isFocused: boolean
startDate?: Date
dateCreated?: Date
}
export default class Input extends PureComponent<InputProps, InputState> {
public state: InputState = {
isFocused: false,
startDate: new Date()
dateCreated: new Date()
}
public inputWrapClasses() {
@ -62,8 +62,15 @@ export default class Input extends PureComponent<InputProps, InputState> {
private handleDateChange = (date: Date) => {
this.setState({
startDate: date
dateCreated: date
})
const event = {
currentTarget: {
name: 'dateCreated',
value: date
}
}
this.props.onChange!(event as any)
}
public InputComponent = () => {
@ -151,8 +158,7 @@ export default class Input extends PureComponent<InputProps, InputState> {
return (
<div className={wrapClass}>
<DatePicker
selected={this.state.startDate}
// TODO: this needs to be able to receive this.props.onChange too
selected={this.state.dateCreated}
onChange={this.handleDateChange}
className={styles.input}
onFocus={this.toggleFocus}