-
Notifications
You must be signed in to change notification settings - Fork 160
fix(pivot-grid): fix date format based on the localization #17254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 21.1.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2380,7 +2380,9 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni | |
| const ref = isGroup ? | ||
| createComponent(IgxColumnGroupComponent, { environmentInjector: this.envInjector, elementInjector: this.injector }) : | ||
| createComponent(IgxColumnComponent, { environmentInjector: this.envInjector, elementInjector: this.injector }); | ||
| ref.instance.header = parent != null ? key.split(parent.header + this.pivotKeys.columnDimensionSeparator)[1] : key; | ||
| const rawHeader = parent != null ? key.split(parent.field + this.pivotKeys.columnDimensionSeparator)[1] : key; | ||
| const dim = value.dimension as IPivotDimension; | ||
| ref.instance.header = dim?.formatter != null ? (dim.formatter(rawHeader) ?? rawHeader) : rawHeader; | ||
| ref.instance.field = key; | ||
|
Comment on lines
+2383
to
2386
|
||
| ref.instance.parent = parent; | ||
| if (value.dimension.width) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1245,7 +1245,8 @@ describe('IgxPivotGrid #pivotGrid', () => { | |
| // check rows | ||
| const rows = pivotGrid.rowList.toArray(); | ||
| expect(rows.length).toBe(5); | ||
| const expectedHeaders = ['All Periods', '2021', 'Q4', 'December', '12/08/2021']; | ||
| const formattedDate = Intl.DateTimeFormat(undefined, { dateStyle: 'short' }).format(new Date(2021, 11, 8)); | ||
| const expectedHeaders = ['All Periods', '2021', 'Q4', 'December', formattedDate]; | ||
|
Comment on lines
+1248
to
+1249
|
||
| const rowHeaders = fixture.debugElement.queryAll( | ||
| By.directive(IgxPivotRowDimensionHeaderComponent)); | ||
| const rowDimensionHeaders = rowHeaders.map(x => x.componentInstance.column.header); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,7 +183,11 @@ export class IgxPivotRowDimensionContentComponent extends IgxGridHeaderRowCompon | |
|
|
||
| protected extractFromDimension(dim: IPivotDimension, rowData: IPivotGridGroupRecord) { | ||
| const field = dim.memberName; | ||
| const header = rowData?.dimensionValues.get(field); | ||
| const rawHeader = rowData?.dimensionValues.get(field); | ||
| let header = rawHeader; | ||
| if (dim.formatter != null) { | ||
| header = dim.formatter(rawHeader) ?? rawHeader; | ||
| } | ||
| const col = this._createColComponent(field, header, dim); | ||
|
Comment on lines
184
to
191
|
||
| return col; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IPivotDimension.formatteris a function-valued API surface similar tomemberFunctionandIPivotValue.formatter, but it currently lacks the interop/codegen annotations used elsewhere in this interface (e.g./* csTreatAsEvent */,/* blazorOnlyScript */). If these markers are required for your generated wrappers, please add the appropriate annotations forformatteras well to avoid breaking non-TS consumers.