[ADF-2997] The meaning of the range fields is not clear (#3338)

* [ADF-2997] restrict 'to' field not to allow dates in the future

* [ADF-2997] more clear labels for start and end date fields

the translation team will decide what will be the best values for the date fields
This commit is contained in:
Suzana Dirla 2018-05-17 13:41:51 +03:00 committed by Eugenio Romano
parent 9e3a4aa49f
commit 4e70a116eb
3 changed files with 9 additions and 5 deletions

View File

@ -182,8 +182,8 @@
"RANGE": {
"FROM": "From",
"TO": "To",
"FROM-DATE": "Choose a date",
"TO-DATE": "Choose a date"
"FROM-DATE": "From",
"TO-DATE": "To"
},
"VALIDATION": {
"REQUIRED-VALUE": "Required value",

View File

@ -3,7 +3,7 @@
<input matInput [formControl]="from" [errorStateMatcher]="matcher"
placeholder="{{ 'SEARCH.FILTER.RANGE.FROM-DATE' | translate }}"
[matDatepicker]="fromDatepicker"
[max]="maxFrom"
[max]="maxDate"
(focusout)="onChangedHandler($event, from)">
<mat-datepicker-toggle matSuffix [for]="fromDatepicker"></mat-datepicker-toggle>
<mat-datepicker #fromDatepicker></mat-datepicker>
@ -20,6 +20,7 @@
placeholder="{{ 'SEARCH.FILTER.RANGE.TO-DATE' | translate }}"
[matDatepicker]="toDatepicker"
[min]="from.value"
[max]="maxDate"
(focusout)="onChangedHandler($event, to)">
<mat-datepicker-toggle matSuffix [for]="toDatepicker"></mat-datepicker-toggle>
<mat-datepicker #toDatepicker></mat-datepicker>
@ -29,6 +30,9 @@
<mat-error *ngIf="to.hasError('matDatepickerMin')">
{{ 'SEARCH.FILTER.VALIDATION.NO-DAYS' | translate }}
</mat-error>
<mat-error *ngIf="to.hasError('matDatepickerMax')">
{{ 'SEARCH.FILTER.VALIDATION.BEYOND-MAX-DATE' | translate }}
</mat-error>
</mat-form-field>
<div class="facet-buttons">

View File

@ -69,7 +69,7 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit {
id: string;
settings?: SearchWidgetSettings;
context?: SearchQueryBuilderService;
maxFrom: any;
maxDate: any;
datePickerDateFormat = DEFAULT_FORMAT_DATE;
constructor(private dateAdapter: DateAdapter<Moment>,
@ -99,7 +99,7 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit {
to: this.to
});
this.maxFrom = moment().startOf('day');
this.maxDate = moment().startOf('day');
}
apply(model: { from: string, to: string }, isValid: boolean) {