I want to use 'en' as locale for the datepickers filtering a date field in my grid, whatever is the value of window.navigator.language.
I know we can do this setting when we're directly implementing igx-date-picker in a template.
I've learned that igxCell and IgxCellEditor can do nice things within the grid's body. But found no equivalent for the filter part.
I've managed to obtain my expected result with
grid.filteringService.datePipe = new DatePipe('en');But as I'm overwriting a private property, it will never go through any prod build.Do you have a turnaround ?
I thank you in advance,
It's not very clear what exactly you're trying to localize. Is it the display value of the filtering cell containing date? Or the date picker itself. Could you please provide more details on what is the current locale in the browser and what exactly you're trying to achieve?
Sorry for those approximations.
I want to programmatically set a range of dates as a filter for on a column. For this purpose I'm using the filteringExpressionsTree property and providing my Date() objects as two different IFilteringExpression.searchValThis works very well as long the browser locale is 'en'As soon I'm using an other browser locale (in my case 'fr'), the following error drops :
InvalidPipeArgument: 'Missing locale data for the locale "fr".' for pipe 'DatePipe'
Obviously, I'm not providing the localeFr from Angular. And I don't want to, because the app is supposed to be used at 95-99% by non-french-speakers.My issue in this case is happening with the 'fr' locale but I do believe the same would happen with 'de', 'pl', 'cz', ... And for the same reasons than with localeFr, I don't want to provide localeDe, localePl, ...That's why I would like to be able to choose/set the locale used to build the IgxFilteringService.datePipe and the local property of the DatePickers that will be generated as the UI for the filters.I hope this makes easier to understand.Thank you for your support,Adrien
Currently filteringService and grid's filtering UI are formatting dates using browser's window.navigator.language. IgxDatePicker and IgxInputGroup components, which are used in the filtering UI are flexible and support different locales. Currently there is no easy way to change the locale in the grid though.
What we can do is to provide a locale property on a grid level. That will ensure that all grid's child components will be using that locale and the grid will stay in the desired language even if the browser's locale is different. Could you please log an issue (add feature_request tag) in the IgniteUI for Angular repo and we will include it in some of the following sprints.