Skip to content

Commit 05b5475

Browse files
authored
Merge pull request #12443 from IgniteUI/skrastev/fix-12406-master
fix(pivotDate): Cache month formatter for pivot date dimension.
2 parents 3a1f17c + 0dcc5ec commit 05b5475

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ export class IgxPivotDateDimension implements IPivotDimension {
126126
private _resourceStrings = CurrentResourceStrings.GridResStrings;
127127
private _baseDimension: IPivotDimension;
128128
private _options: IPivotDateDimensionOptions = {};
129+
private _monthIntl = new Intl.DateTimeFormat('default', { month: 'long' });
130+
129131
/**
130132
* Creates additional pivot date dimensions based on a provided dimension describing date data:
131133
*
@@ -156,7 +158,7 @@ export class IgxPivotDateDimension implements IPivotDimension {
156158
memberName: 'Months',
157159
memberFunction: (rec) => {
158160
const recordValue = PivotUtil.extractValueFromDimension(inBaseDimension, rec);
159-
return recordValue ? new Date(recordValue).toLocaleString('default', { month: 'long' }) : rec['Months'];
161+
return recordValue ? this._monthIntl.format(new Date(recordValue)) : rec['Months'];
160162
},
161163
enabled: true,
162164
childLevel: baseDimension

0 commit comments

Comments
 (0)