From 423fe1e23111ad2f49198545c51d3aed36240975 Mon Sep 17 00:00:00 2001 From: Aleksander Sklorz Date: Wed, 25 Oct 2023 13:34:18 +0200 Subject: [PATCH 1/4] ACS-6189 Fixed date format --- .../components/widgets/date-range/date-range.widget.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts b/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts index 162c54b60d7..a176d82ced3 100644 --- a/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts +++ b/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts @@ -24,7 +24,7 @@ import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { ReportParameterDetailsModel } from '../../../../diagram/models/report/report-parameter-details.model'; import { isAfter } from 'date-fns'; -const FORMAT_DATE_ACTIVITI = 'yyyy-MM-dd'; +const FORMAT_DATE_ACTIVITI = 'dd-MM-yyyy'; const DISPLAY_FORMAT = 'dd/MM/yyyy'; interface DateRangeProps { From 4d9427cc5e055e2fcfd8283d5d7815a7f2613b2a Mon Sep 17 00:00:00 2001 From: Aleksander Sklorz Date: Wed, 25 Oct 2023 13:37:17 +0200 Subject: [PATCH 2/4] ACS-6189 Fixed unit test --- .../components/widgets/date-range/date-range.widget.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.spec.ts b/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.spec.ts index 1b2a848a43f..3d2a4dbb7bf 100644 --- a/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.spec.ts +++ b/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.spec.ts @@ -75,8 +75,8 @@ describe('DateRangeWidgetComponent', () => { widget.onGroupValueChanged(); - expect(emitted.startDate).toBe('2023-03-13T00:00:00.000Z'); - expect(emitted.endDate).toBe('2023-04-14T00:00:00.000Z'); + expect(emitted.startDate).toBe('13/03/2023T00:00:00.000Z'); + expect(emitted.endDate).toBe('14/04/2023T00:00:00.000Z'); }); it('should validate date range', async () => { From 45fa6c1671a3f7993c7122be72221e4a2fc73969 Mon Sep 17 00:00:00 2001 From: Aleksander Sklorz Date: Wed, 25 Oct 2023 14:49:27 +0200 Subject: [PATCH 3/4] ACS-6189 Reverted unwanted changes --- .../components/widgets/date-range/date-range.widget.spec.ts | 4 ++-- .../components/widgets/date-range/date-range.widget.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.spec.ts b/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.spec.ts index 3d2a4dbb7bf..1b2a848a43f 100644 --- a/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.spec.ts +++ b/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.spec.ts @@ -75,8 +75,8 @@ describe('DateRangeWidgetComponent', () => { widget.onGroupValueChanged(); - expect(emitted.startDate).toBe('13/03/2023T00:00:00.000Z'); - expect(emitted.endDate).toBe('14/04/2023T00:00:00.000Z'); + expect(emitted.startDate).toBe('2023-03-13T00:00:00.000Z'); + expect(emitted.endDate).toBe('2023-04-14T00:00:00.000Z'); }); it('should validate date range', async () => { diff --git a/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts b/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts index a176d82ced3..162c54b60d7 100644 --- a/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts +++ b/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts @@ -24,7 +24,7 @@ import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { ReportParameterDetailsModel } from '../../../../diagram/models/report/report-parameter-details.model'; import { isAfter } from 'date-fns'; -const FORMAT_DATE_ACTIVITI = 'dd-MM-yyyy'; +const FORMAT_DATE_ACTIVITI = 'yyyy-MM-dd'; const DISPLAY_FORMAT = 'dd/MM/yyyy'; interface DateRangeProps { From f7ef47a43630b6340eafef223158a4a4b161edf9 Mon Sep 17 00:00:00 2001 From: Aleksander Sklorz Date: Wed, 25 Oct 2023 14:54:04 +0200 Subject: [PATCH 4/4] ACS-6189 Fixed date format --- .../src/lib/common/process-common.module.ts | 7 +++- .../widgets/date/date-cloud.widget.ts | 5 +-- .../src/lib/form/date-formats.ts | 38 ------------------- .../src/lib/form/public-api.ts | 1 - 4 files changed, 7 insertions(+), 44 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/form/date-formats.ts 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 82fb18b6261..9c6309fb329 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,11 +16,12 @@ */ import { NgModule } from '@angular/core'; -import { CoreModule } from '@alfresco/adf-core'; +import { ADF_DATE_FORMATS, AdfDateFnsAdapter, 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 ], @@ -33,7 +34,9 @@ import { DateRangeFilterService } from './date-range-filter/date-range-filter.se DateRangeFilterComponent ], providers: [ - DateRangeFilterService + DateRangeFilterService, + { provide: DateAdapter, useClass: AdfDateFnsAdapter }, + { provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS } ] }) export class ProcessCommonModule {} diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.ts b/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.ts index 9043723b8e6..f94231c0602 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.ts @@ -20,15 +20,14 @@ import { Component, OnInit, ViewEncapsulation, OnDestroy, Input } from '@angular/core'; import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { Subject } from 'rxjs'; -import { WidgetComponent, FormService, AdfDateFnsAdapter, DateFnsUtils } from '@alfresco/adf-core'; +import { WidgetComponent, FormService, AdfDateFnsAdapter, DateFnsUtils, ADF_DATE_FORMATS } from '@alfresco/adf-core'; import { MatDatepickerInputEvent } from '@angular/material/datepicker'; -import { CLOUD_FORM_DATE_FORMATS } from '../../../date-formats'; import { addDays, subDays } from 'date-fns'; @Component({ selector: 'date-widget', providers: [ - { provide: MAT_DATE_FORMATS, useValue: CLOUD_FORM_DATE_FORMATS }, + { provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS }, { provide: DateAdapter, useClass: AdfDateFnsAdapter } ], templateUrl: './date-cloud.widget.html', diff --git a/lib/process-services-cloud/src/lib/form/date-formats.ts b/lib/process-services-cloud/src/lib/form/date-formats.ts deleted file mode 100644 index 64aebc4e891..00000000000 --- a/lib/process-services-cloud/src/lib/form/date-formats.ts +++ /dev/null @@ -1,38 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { MatDateFormats } from '@angular/material/core'; - -/** - * Provides date/time display formatting for the cloud components. - * - * Notes for developers: display formats are different from the storage formats. - * Components have a fixed format for saving dates and datetime values, - * while dynamic format for UI display. - */ -export const CLOUD_FORM_DATE_FORMATS: MatDateFormats = { - parse: { - dateInput: 'dd-MM-yyyy' - }, - display: { - dateInput: 'dd-MM-yyyy', - monthLabel: 'LLL', - monthYearLabel: 'LLL uuuu', - dateA11yLabel: 'PP', - monthYearA11yLabel: 'LLLL uuuu' - } -}; diff --git a/lib/process-services-cloud/src/lib/form/public-api.ts b/lib/process-services-cloud/src/lib/form/public-api.ts index aede55d9745..deea686958f 100644 --- a/lib/process-services-cloud/src/lib/form/public-api.ts +++ b/lib/process-services-cloud/src/lib/form/public-api.ts @@ -40,4 +40,3 @@ export * from './services/content-cloud-node-selector.service'; export * from './services/process-cloud-content.service'; export * from './form-cloud.module'; -export * from './date-formats';