Skip to content

Commit 14fe923

Browse files
authored
Merge pull request #12442 from IgniteUI/skrastev/fix-12406-15.0.x
fix(pivotDate): Cache month formatter for pivot date dimension.
2 parents ff0e9c2 + 179351e commit 14fe923

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid-dimensions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export interface IPivotDateDimensionOptions {
4747
export class IgxPivotDateDimension implements IPivotDimension {
4848
/** Enables/Disables a particular dimension from pivot structure. */
4949
public enabled = true;
50-
50+
5151
/**
5252
* Gets/Sets data type
5353
*/
@@ -80,6 +80,7 @@ export class IgxPivotDateDimension implements IPivotDimension {
8080
/** @hidden @internal */
8181
public memberName = 'AllPeriods';
8282
private _resourceStrings = CurrentResourceStrings.GridResStrings;
83+
private _monthIntl = new Intl.DateTimeFormat('default', { month: 'long' });
8384

8485
/**
8586
* Creates additional pivot date dimensions based on a provided dimension describing date data:
@@ -108,7 +109,7 @@ export class IgxPivotDateDimension implements IPivotDimension {
108109
memberName: 'Months',
109110
memberFunction: (rec) => {
110111
const recordValue = PivotUtil.extractValueFromDimension(inBaseDimension, rec);
111-
return recordValue ? new Date(recordValue).toLocaleString('default', { month: 'long' }) : rec['Months'];
112+
return recordValue ? this._monthIntl.format(new Date(recordValue)) : rec['Months'];
112113
},
113114
enabled: true,
114115
childLevel: baseDimension

0 commit comments

Comments
 (0)