-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Starting from the version 5 Angular uses CLDR data for number/date/currency internalization. It uses internal formatters for this purpose and does not reexports them to be available for developers. I mean formatters describes in these files: format_date.ts, format_number.ts.
Expected behavior
Reexported formatters will allow to localize data in code.
What is the motivation / use case for changing the behavior?
Sometimes it is necessary to translate dates or numbers in code rather than in templates.
For example, when we use 3rd-party components, like ag-grid, we can define custom formatters for date represented in grid and it will be a large overhead to use Angular component for this purpose. Much easier is to use formatting capabilities embedded into Angular itself to reach consistent formatting.
Another case is messages generated in code.
Environment
Angular version: 5.x.x