From 3d11db36de5305d9c62f7ba4d23d656dd421c86f Mon Sep 17 00:00:00 2001 From: Aleksander Sklorz Date: Thu, 26 Oct 2023 10:03:50 +0200 Subject: [PATCH] ACS-6189 Moved date adapter from module to component --- .../date-range-filter/date-range-filter.component.ts | 8 +++++++- .../src/lib/common/process-common.module.ts | 7 ++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.ts b/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.ts index a90e003bab5..11c2a8a83ac 100644 --- a/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.ts +++ b/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.ts @@ -21,6 +21,8 @@ import { ProcessFilterProperties, ProcessFilterOptions } from '../../process/pro import { FormGroup, FormControl } from '@angular/forms'; import { DateRangeFilter, DateCloudFilterType } from '../../models/date-cloud-filter.model'; import { endOfDay, isValid, startOfDay } from 'date-fns'; +import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; +import { ADF_DATE_FORMATS, AdfDateFnsAdapter } from '@alfresco/adf-core'; interface DateRangeFormProps { from: FormControl; @@ -30,7 +32,11 @@ interface DateRangeFormProps { @Component({ selector: 'adf-cloud-date-range-filter', styleUrls: ['./date-range-filter.component.scss'], - templateUrl: './date-range-filter.component.html' + templateUrl: './date-range-filter.component.html', + providers: [ + { provide: DateAdapter, useClass: AdfDateFnsAdapter }, + { provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS } + ] }) export class DateRangeFilterComponent implements OnInit { @Input() diff --git a/lib/process-services-cloud/src/lib/common/process-common.module.ts b/lib/process-services-cloud/src/lib/common/process-common.module.ts index 9c6309fb329..82fb18b6261 100644 --- a/lib/process-services-cloud/src/lib/common/process-common.module.ts +++ b/lib/process-services-cloud/src/lib/common/process-common.module.ts @@ -16,12 +16,11 @@ */ import { NgModule } from '@angular/core'; -import { ADF_DATE_FORMATS, AdfDateFnsAdapter, CoreModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { DateRangeFilterComponent } from './date-range-filter/date-range-filter.component'; import { MaterialModule } from '../material.module'; import { CommonModule } from '@angular/common'; import { DateRangeFilterService } from './date-range-filter/date-range-filter.service'; -import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; @NgModule({ declarations: [ DateRangeFilterComponent ], @@ -34,9 +33,7 @@ import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; DateRangeFilterComponent ], providers: [ - DateRangeFilterService, - { provide: DateAdapter, useClass: AdfDateFnsAdapter }, - { provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS } + DateRangeFilterService ] }) export class ProcessCommonModule {}