@@ -5,6 +5,7 @@ exports[`should render correctly the date inputs 1`] = ` | |||
<DateInput | |||
className="little-spacer-right" | |||
format="yy-mm-dd" | |||
maxDate="+0" | |||
name="from" | |||
onChange={[Function]} | |||
placeholder="from" | |||
@@ -14,6 +15,7 @@ exports[`should render correctly the date inputs 1`] = ` | |||
<DateInput | |||
className="little-spacer-left" | |||
format="yy-mm-dd" | |||
maxDate="+0" | |||
name="to" | |||
onChange={[Function]} | |||
placeholder="to" |
@@ -121,6 +121,7 @@ exports[`render qualifiers filter 1`] = ` | |||
<DateInput | |||
format="yy-mm-dd" | |||
inputClassName="input-medium" | |||
maxDate="+0" | |||
name="analyzed-before" | |||
onChange={[Function]} | |||
placeholder="last_analysis_before" | |||
@@ -223,6 +224,7 @@ exports[`renders 1`] = ` | |||
<DateInput | |||
format="yy-mm-dd" | |||
inputClassName="input-medium" | |||
maxDate="+0" | |||
name="analyzed-before" | |||
onChange={[Function]} | |||
placeholder="last_analysis_before" |
@@ -28,6 +28,8 @@ interface Props { | |||
className?: string; | |||
format?: string; | |||
inputClassName?: string; | |||
// see http://api.jqueryui.com/datepicker/#option-maxDate for details | |||
maxDate?: Date | string | number; | |||
name: string; | |||
onChange: (value?: string) => void; | |||
placeholder: string; | |||
@@ -38,7 +40,8 @@ export default class DateInput extends React.PureComponent<Props> { | |||
input: HTMLInputElement; | |||
static defaultProps = { | |||
format: 'yy-mm-dd' | |||
format: 'yy-mm-dd', | |||
maxDate: '+0' | |||
}; | |||
componentDidMount() { | |||
@@ -61,6 +64,7 @@ export default class DateInput extends React.PureComponent<Props> { | |||
dateFormat: this.props.format, | |||
changeMonth: true, | |||
changeYear: true, | |||
maxDate: this.props.maxDate, | |||
onSelect: this.handleChange | |||
}; | |||