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