From 4e70a116ebb10102494829b6a0a291dc44d9b432 Mon Sep 17 00:00:00 2001 From: Suzana Dirla Date: Thu, 17 May 2018 13:41:51 +0300 Subject: [PATCH] [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 --- lib/content-services/i18n/en.json | 4 ++-- .../search-date-range/search-date-range.component.html | 6 +++++- .../search-date-range/search-date-range.component.ts | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/content-services/i18n/en.json b/lib/content-services/i18n/en.json index 108fdd2d89..effecc279a 100644 --- a/lib/content-services/i18n/en.json +++ b/lib/content-services/i18n/en.json @@ -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", diff --git a/lib/content-services/search/components/search-date-range/search-date-range.component.html b/lib/content-services/search/components/search-date-range/search-date-range.component.html index b1cb62f0e0..f50400aeb0 100644 --- a/lib/content-services/search/components/search-date-range/search-date-range.component.html +++ b/lib/content-services/search/components/search-date-range/search-date-range.component.html @@ -3,7 +3,7 @@ @@ -20,6 +20,7 @@ placeholder="{{ 'SEARCH.FILTER.RANGE.TO-DATE' | translate }}" [matDatepicker]="toDatepicker" [min]="from.value" + [max]="maxDate" (focusout)="onChangedHandler($event, to)"> @@ -29,6 +30,9 @@ {{ 'SEARCH.FILTER.VALIDATION.NO-DAYS' | translate }} + + {{ 'SEARCH.FILTER.VALIDATION.BEYOND-MAX-DATE' | translate }} +
diff --git a/lib/content-services/search/components/search-date-range/search-date-range.component.ts b/lib/content-services/search/components/search-date-range/search-date-range.component.ts index 13d9ed16b8..7480b28c70 100644 --- a/lib/content-services/search/components/search-date-range/search-date-range.component.ts +++ b/lib/content-services/search/components/search-date-range/search-date-range.component.ts @@ -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, @@ -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) {