Skip to content

Commit

Permalink
chore(igx-grid): Fix typo and make little refactoring, #3455
Browse files Browse the repository at this point in the history
  • Loading branch information
sstoyanovIG committed Jan 9, 2019
1 parent e36bbd4 commit 8d8541d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class IgxFilteringService implements OnDestroy {
private columnToExpressionsMap = new Map<string, ExpressionUI[]>();
private filterPipe = new IgxGridFilterConditionPipe();
private titlecasePipe = new TitleCasePipe();
private datePipe = new IgxDatePipeComponent(window.navigator.language);
private _datePipe: IgxDatePipeComponent;
private columnStartIndex = -1;

public gridId: string;
Expand Down Expand Up @@ -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.
*/
Expand Down
4 changes: 3 additions & 1 deletion projects/igniteui-angular/src/lib/grids/grid.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 8d8541d

Please sign in to comment.