Browse Source

do not let select date in future

tags/6.7-RC1
Stas Vilchik 6 years ago
parent
commit
f5cadba1d1

+ 2
- 0
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityDateInput-test.js.snap View File

@@ -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"

+ 2
- 0
server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/Search-test.tsx.snap View File

@@ -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"

+ 5
- 1
server/sonar-web/src/main/js/components/controls/DateInput.tsx View File

@@ -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
};


Loading…
Cancel
Save