mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
updates
This commit is contained in:
+3
-3
@@ -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();
|
||||
|
||||
|
||||
+2
-2
@@ -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 {
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user