
Brian Vallelunga
Top achievements
Rank 1
Brian Vallelunga
asked on 20 Sep 2018, 08:38 PM
I'm looking for a replacement in the new Kendo UI for Angular that provides the same capabilities as kendo.format in order to conditionally format a number or date. Does this exist?
Specifically, I have some data and a formatting string in the form of: {0:N2} or {0:yyyyMMdd} and want to format the data to a string. Previously, I used the kendo.format function, but I haven't found it yet.
4 Answers, 1 is accepted
0
Hi Brian,
You can use the Intl service methods to parse and format date and numbers:
https://www.telerik.com/kendo-angular-ui/components/globalization/internationalization/parsing-and-formatting/
https://www.telerik.com/kendo-angular-ui/components/globalization/internationalization/parsing-and-formatting/#toc-date-formatting
https://www.telerik.com/kendo-angular-ui/components/globalization/internationalization/parsing-and-formatting/#toc-number-formatting
Here is the API of the IntlService:
https://www.telerik.com/kendo-angular-ui/components/globalization/internationalization/api/IntlService/
... and a small demo demonstrating some of the methods:
https://stackblitz.com/edit/angular-k2xa9x?file=app/app.component.ts
You can also utilize the kendoNumber and kendoDate pipes:
https://www.telerik.com/kendo-angular-ui/components/globalization/internationalization/pipes/
I hope this helps.
Regards,
Dimiter Topalov
Progress Telerik
You can use the Intl service methods to parse and format date and numbers:
https://www.telerik.com/kendo-angular-ui/components/globalization/internationalization/parsing-and-formatting/
https://www.telerik.com/kendo-angular-ui/components/globalization/internationalization/parsing-and-formatting/#toc-date-formatting
https://www.telerik.com/kendo-angular-ui/components/globalization/internationalization/parsing-and-formatting/#toc-number-formatting
Here is the API of the IntlService:
https://www.telerik.com/kendo-angular-ui/components/globalization/internationalization/api/IntlService/
... and a small demo demonstrating some of the methods:
https://stackblitz.com/edit/angular-k2xa9x?file=app/app.component.ts
You can also utilize the kendoNumber and kendoDate pipes:
https://www.telerik.com/kendo-angular-ui/components/globalization/internationalization/pipes/
I hope this helps.
Regards,
Dimiter Topalov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0

Brian Vallelunga
Top achievements
Rank 1
answered on 21 Sep 2018, 05:13 PM
Thanks, but out of curiosity, when I create a column in the grid I can specify the syntax as {0:N2}. Yet the kendoNumber pipe and other formatters expect just the N2 portion. How does the grid use the {0:N2} syntax to create its default output? That's what I'd like to implement in my own templates so I can keep the same syntax.
0
Hi Brian,
You can check the source code of the kendo-angular-intl and the kendo-angular-grid packages in order to get the needed insights on the implementation details for the NumberPipe, the IntlService, and the grid's formatting. The following article demonstrates, how to get the source code of any Kendo Ui for Angular package:
https://www.telerik.com/kendo-angular-ui/components/installation/source-code/
I hope this helps.
Regards,
Svetlin
Progress Telerik
You can check the source code of the kendo-angular-intl and the kendo-angular-grid packages in order to get the needed insights on the implementation details for the NumberPipe, the IntlService, and the grid's formatting. The following article demonstrates, how to get the source code of any Kendo Ui for Angular package:
https://www.telerik.com/kendo-angular-ui/components/installation/source-code/
I hope this helps.
Regards,
Svetlin
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0

Brian Vallelunga
Top achievements
Rank 1
answered on 26 Sep 2018, 01:14 AM
Thanks. This was helpful.