diff --git a/lib/content-services/src/lib/search/components/search-date-range/search-date-range.component.spec.ts b/lib/content-services/src/lib/search/components/search-date-range/search-date-range.component.spec.ts index 8112bfdf2c..22dac31d4e 100644 --- a/lib/content-services/src/lib/search/components/search-date-range/search-date-range.component.spec.ts +++ b/lib/content-services/src/lib/search/components/search-date-range/search-date-range.component.spec.ts @@ -22,7 +22,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ContentTestingModule } from '../../../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; import { DateFnsAdapter } from '@angular/material-date-fns-adapter'; -import { endOfDay, endOfToday, isValid, parse, startOfDay } from 'date-fns'; +import { endOfDay, endOfToday, isValid, startOfDay } from 'date-fns'; declare let moment: any; @@ -77,7 +77,7 @@ describe('SearchDateRangeComponent', () => { fixture.detectChanges(); const inputString = '20-feb-18'; - const dateFromInput = parse(inputString, DateFnsUtils.convertMomentToDateFnsFormat(dateFormatFixture), new Date()); + const dateFromInput = DateFnsUtils.parseDate(inputString, DateFnsUtils.convertMomentToDateFnsFormat(dateFormatFixture)); expect(isValid(dateFromInput)).toBeTruthy(); @@ -91,7 +91,7 @@ describe('SearchDateRangeComponent', () => { fixture.detectChanges(); const inputString = '20.f.18'; - const dateFromInput = parse(inputString, DateFnsUtils.convertMomentToDateFnsFormat(dateFormatFixture), new Date()); + const dateFromInput = DateFnsUtils.parseDate(inputString, DateFnsUtils.convertMomentToDateFnsFormat(dateFormatFixture)); expect(isValid(dateFromInput)).toBeFalsy(); diff --git a/lib/content-services/src/lib/search/components/search-date-range/search-date-range.component.ts b/lib/content-services/src/lib/search/components/search-date-range/search-date-range.component.ts index 368841e3d9..aedf4892e0 100644 --- a/lib/content-services/src/lib/search/components/search-date-range/search-date-range.component.ts +++ b/lib/content-services/src/lib/search/components/search-date-range/search-date-range.component.ts @@ -115,8 +115,8 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit, OnDestroy if (this.startValue) { const splitValue = this.startValue.split('||'); - const fromValue = this.dateAdapter.parse(splitValue[0], DateFnsUtils.convertMomentToDateFnsFormat(this.datePickerFormat)); - const toValue = this.dateAdapter.parse(splitValue[1], DateFnsUtils.convertMomentToDateFnsFormat(this.datePickerFormat)); + const fromValue = this.dateAdapter.parse(splitValue[0], this.datePickerFormat); + const toValue = this.dateAdapter.parse(splitValue[1], this.datePickerFormat); this.from = new UntypedFormControl(fromValue, validators); this.to = new UntypedFormControl(toValue, validators); } else { diff --git a/lib/insights/src/lib/analytics-process/components/analytics-report-parameters.component.ts b/lib/insights/src/lib/analytics-process/components/analytics-report-parameters.component.ts index f1e04a69a5..86d8a5ac96 100644 --- a/lib/insights/src/lib/analytics-process/components/analytics-report-parameters.component.ts +++ b/lib/insights/src/lib/analytics-process/components/analytics-report-parameters.component.ts @@ -185,11 +185,11 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On } } - convertMomentDate(date: string) { + convertMomentDate(date: string): string { return DateFnsUtils.formatDate(new Date(date), FORMAT_DATE_ACTIVITI) + 'T00:00:00.000Z' } - getTodayDate() { + getTodayDate(): string { return DateFnsUtils.formatDate(new Date(), FORMAT_DATE_ACTIVITI); }