Error in formatNumber when using specific custom number format

6 posts, 0 answers
  1. Jaap
    Jaap avatar
    96 posts
    Member since:
    Oct 2012

    Posted 03 May 2012 Link to this post

    Hello,

    The formatNumber function gives an error when you try to format a number with a custom number format 0.####
    The problem is that there are no zeros after the decimalseparator.
    I have fixed it in the Kendo code, but not sure if I may post that here on the forum.

    Also, looking to the code, I think there is an issue, when you have a number 1.23456 and you want to format it with 0.0##. You will get 1.23456 instead of 1.235.

    Regards, Jaap
  2. Jaap
    Jaap avatar
    96 posts
    Member since:
    Oct 2012

    Posted 03 May 2012 Link to this post

    Some other issues I found:

    Formatting the number 4000 with 0,000.########## results in 04,000 while it should be 4,000
    Formatting the number 300 with 0,000.########## results in 0300 while it should be 0,300

    #,##0.######### works ok.
  3. Kendo UI is VS 2017 Ready
  4. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 07 May 2012 Link to this post

    Hi Jaap,

     
    Thank you for pointing these issues related with the custom numeric formatting. We addressed all of them and the fixes will be included in the service pack of KendoUI scheduled for the mid of May.
    As a gratitude for your involvement I have updated your Telerik points.

    Greetings,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Alexander
    Alexander avatar
    19 posts
    Member since:
    Jun 2012

    Posted 22 Mar 2013 Link to this post

    Have these issues been fixed?
    I am using v2012.3.14120.03019 and see the following behavior:

    kendo.toString(0.06608, "n4") = 0.0661
    kendo.toString(0.06608, "0.0000") = 0.0661
    kendo.toString(0.06608, "#.####") = 0.06608
    I expect this should be 0.0661.

    kendo.toString(0.06608, "n3") = 0.066
    kendo.toString(0.06608, "0.000") = 0.066
    kendo.toString(0.06608, "#.###") = 0.06608
    I expect this should be 0.066.

    kendo.toString(0.0364, "n4") = 0.0364 
    kendo.toString(0.0364, "0.0000") = 0.0364
    kendo.toString(0.0364, "#.####") = 0.0364

    kendo.toString(0.0364, "n3") = 0.036
    kendo.toString(0.0364, "0.000") = 0.036
    kendo.toString(0.0364, "#.###") = 0.0364
    I expect this should be 0.036.

    What I'm looking for is a way to format a number to always have less than or equal to four decimal places:
    kendo.toString(0.06, x) = 0.06
    kendo.toString(0.066, x) = 0.066
    kendo.toString(0.0660, x) = 0.0660
    kendo.toString(0.06608, x) = 0.0661
    Is there a value I can use for x in this case?
  6. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 25 Mar 2013 Link to this post

    Hello Alexsander,

     
    I believe that all aforementioned formats work as expected. Check this jsBin demo for more information. To answer you question you can use "#.####" format.

    Regards,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Alexander
    Alexander avatar
    19 posts
    Member since:
    Jun 2012

    Posted 25 Mar 2013 Link to this post

    Georgi, thanks for the response. As you can see in this JSFiddle using Kendo v2012.3.1412 the "#.####" format does not result in the correct value. Your JSBin example uses v2013.1.319 so it appears this was an issue with the  earlier version of Kendo. Unfortunately I am not realistically able to upgrade Kendo as a solution at this point, so I'll have to find some other workaround. Thanks again.
Back to Top
Kendo UI is VS 2017 Ready