Browse Source

fix createPicker.tsx

pull/2167/head
afc163 9 years ago
parent
commit
619ceffd7e
  1. 6
      components/date-picker/createPicker.tsx

6
components/date-picker/createPicker.tsx

@ -24,17 +24,17 @@ export default function createPicker(TheCalendar) {
} }
}, },
clearSelection = (e) => { clearSelection(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.setState({ value: null }); this.setState({ value: null });
this.handleChange(null); this.handleChange(null);
}, },
handleChange = (value) => { handleChange(value) {
const props = this.props; const props = this.props;
if (!('value' in props)) { if (!('value' in props)) {
this.setState({value}); this.setState({ value });
} }
const timeValue = value ? new Date(value.getTime()) : null; const timeValue = value ? new Date(value.getTime()) : null;
props.onChange(timeValue, value ? props.getFormatter().format(value) : ''); props.onChange(timeValue, value ? props.getFormatter().format(value) : '');

Loading…
Cancel
Save