diff --git a/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts b/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts index bb85bc7b369..4f727d1cd6d 100644 --- a/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts +++ b/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts @@ -24,7 +24,7 @@ import { CoreTestingModule } from '../../../testing/core.testing.module'; import { ClipboardService } from '../../../clipboard/clipboard.service'; import { CardViewDatetimeItemModel } from '../../models/card-view-datetimeitem.model'; import { TranslateModule } from '@ngx-translate/core'; -import { AppConfigService } from '@alfresco/adf-core'; +import { AppConfigService } from '../../../app-config/app-config.service'; import { MatDatetimepickerInputEvent } from '@mat-datetimepicker/core'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; diff --git a/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.ts b/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.ts index c1da00bbdb6..d917697ef5e 100644 --- a/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.ts +++ b/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.ts @@ -26,7 +26,6 @@ import { ClipboardService } from '../../../clipboard/clipboard.service'; import { TranslationService } from '../../../translation/translation.service'; import { ADF_DATE_FORMATS, AdfDateFnsAdapter } from '../../../common/utils/date-fns-adapter'; import { ADF_DATETIME_FORMATS, AdfDateTimeFnsAdapter } from '../../../common/utils/datetime-fns-adapter'; -import { DateFnsUtils } from '../../../common'; import { isValid } from 'date-fns'; @Component({ @@ -74,13 +73,9 @@ export class CardViewDateItemComponent extends BaseCardView) { if (event.value) { if (isValid(event.value)) { + this.property.value = new Date(event.value); + if (this.property.type === 'date') { + this.property.value.setHours(0, 0, 0, 0); + } this.valueDate = event.value; - this.property.value = DateFnsUtils.utcToLocal(event.value); this.update(); } } @@ -127,7 +125,11 @@ export class CardViewDateItemComponent extends BaseCardView) { if (event.value) { if (isValid(event.value) && this.property.multivalued && Array.isArray(this.property.value)) { - this.property.value.push(DateFnsUtils.utcToLocal(event.value)); + const localDate = event.value; + if (this.property.type === 'date') { + localDate.setHours(0, 0, 0, 0); + } + this.property.value.push(localDate); this.update(); } } @@ -143,4 +145,30 @@ export class CardViewDateItemComponent extends BaseCardView 0) { + this.property.value = this.property.value.map((date: Date) => { + const localDate = new Date(date); + if (this.property.type === 'date') { + localDate.setHours(0, 0, 0, 0); + } + return localDate; + }); + this.valueDate = this.property.value[0]; + } + } } diff --git a/lib/process-services-cloud/src/lib/process/process-header/components/process-header-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-header/components/process-header-cloud.component.spec.ts index 7417e2658e4..f8c08702d39 100644 --- a/lib/process-services-cloud/src/lib/process/process-header/components/process-header-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-header/components/process-header-cloud.component.spec.ts @@ -225,8 +225,8 @@ describe('ProcessHeaderCloudComponent', () => { const lastModifiedElement = fixture.debugElement.query(By.css('[data-automation-id="header-lastModified"] .adf-property-value')); expect(component.dateFormat).toEqual('full'); - expect(startedDateElement.nativeElement.innerText.trim()).toBe('Saturday, March 9, 2019 at 5:23:07 PM GMT+00:00'); - expect(lastModifiedElement.nativeElement.innerText.trim()).toBe('Saturday, March 9, 2019 at 5:23:07 PM GMT+00:00'); + expect(startedDateElement.nativeElement.innerText.trim()).toBe('Saturday, March 9, 2019 at 12:00:00 AM GMT+00:00'); + expect(lastModifiedElement.nativeElement.innerText.trim()).toBe('Saturday, March 9, 2019 at 12:00:00 AM GMT+00:00'); }); }); }); diff --git a/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts index d8b4fd70548..ab8e5401994 100644 --- a/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts @@ -503,7 +503,7 @@ describe('TaskHeaderCloudComponent', () => { const createdDateElement = fixture.debugElement.query(By.css('[data-automation-id="header-created"] .adf-property-value')); expect(component.dateFormat).toEqual('full'); - expect(createdDateElement.nativeElement.innerText.trim()).toBe('Monday, December 17, 2018 at 12:00:55 PM GMT+00:00'); + expect(createdDateElement.nativeElement.innerText.trim()).toBe('Monday, December 17, 2018 at 12:00:00 AM GMT+00:00'); }); });