diff --git a/CHANGELOG.md b/CHANGELOG.md index 79079996747..483b26f85fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ All notable changes for each version of this project will be documented in this - Added a new `igxToolbarCustomContent` directive which can be used to mark an `ng-template` which provides a custom content for the IgxGrid's toolbar ([#2983](https://github.com/IgniteUI/igniteui-angular/issues/2983)) - Summary results are now calculated and displayed by default for each row group when 'Group By' feature is enabled. - `clearSummaryCache()` and `recalculateSummaries()` methods are deprecated. The grid will clear the cache and recalculate the summaries automatically when needed. - - `locale` property added. If not set, it returns browser's languge. All child components will use it as locale. + - `locale` property added. If not set, it returns browser's language. All child components will use it as locale. - **Breaking change** `IgxSummaryOperand.operate()` method is called with empty data in order to calculate the necessary height for the summary row. For custom summary operands, the method should always return an array of `IgxSummaryResult` with proper length. - `IgxIconModule`: - **Breaking change** `igxIconService` is now provided in root (providedIn: 'root') and `IgxIconModule.forRoot()` method is deprecated. diff --git a/projects/igniteui-angular/src/lib/grids/filtering/grid-filtering.service.ts b/projects/igniteui-angular/src/lib/grids/filtering/grid-filtering.service.ts index a5d05658a6b..d8a2e665d33 100644 --- a/projects/igniteui-angular/src/lib/grids/filtering/grid-filtering.service.ts +++ b/projects/igniteui-angular/src/lib/grids/filtering/grid-filtering.service.ts @@ -38,7 +38,7 @@ export class IgxFilteringService implements OnDestroy { private columnToExpressionsMap = new Map(); private filterPipe = new IgxGridFilterConditionPipe(); private titlecasePipe = new TitleCasePipe(); - private datePipe = new IgxDatePipeComponent(window.navigator.language); + private _datePipe: IgxDatePipeComponent; private columnStartIndex = -1; public gridId: string; @@ -76,6 +76,13 @@ export class IgxFilteringService implements OnDestroy { return this.gridAPI.get(this.gridId); } + public get datePipe(): IgxDatePipeComponent { + if (!this._datePipe) { + this._datePipe = new IgxDatePipeComponent(this.grid.locale); + } + return this._datePipe; + } + /** * Subscribe to grid's events. */ diff --git a/projects/igniteui-angular/src/lib/grids/grid.common.ts b/projects/igniteui-angular/src/lib/grids/grid.common.ts index b2cacf3be43..8ffaa5a4634 100644 --- a/projects/igniteui-angular/src/lib/grids/grid.common.ts +++ b/projects/igniteui-angular/src/lib/grids/grid.common.ts @@ -26,6 +26,8 @@ import { ConnectedPositioningStrategy } from '../services'; import { getPointFromPositionsSettings, VerticalAlignment, PositionSettings } from '../services/overlay/utilities'; import { scaleInVerBottom, scaleInVerTop } from '../animations/main'; +const DEFAULT_DATE_FORMAT = 'mediumDate'; + /** * @hidden */ @@ -577,7 +579,7 @@ export class IgxDatePipeComponent extends DatePipe implements PipeTransform { transform(value: any, locale: string): string { if (value && value instanceof Date) { if (locale) { - return super.transform(value, 'mediumDate', undefined, locale); + return super.transform(value, DEFAULT_DATE_FORMAT, undefined, locale); } else { return super.transform(value); }