kendo.format trailing zeroes for decimal number formatting

5 posts, 0 answers
  1. Boris Gheihman
    Boris Gheihman avatar
    12 posts
    Member since:
    May 2007

    Posted 02 Mar 2015 Link to this post

    I'm getting strange results for kendo.format:
    kendo.format('{0:0.##%}', 0.035) // 3.50%
    kendo.format('{0:0.##%}', 0.045) // 4.5%

    It's very unexpected behavior. I could reproduce it on latest version of kendo, here is a dojo.
  2. Petyo
    Admin
    Petyo avatar
    2444 posts

    Posted 04 Mar 2015 Link to this post

    Hi Boris,

    you should escape the percentage sign, like our documentation states.

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Boris Gheihman
    Boris Gheihman avatar
    12 posts
    Member since:
    May 2007

    Posted 04 Mar 2015 Link to this post

    I'm sorry Petyo, I didn't specify the exact issue. I want it to be transformed and rendered as percentage actually. I'm just not sure why I have trailing zero in first example. I think it should be rendered as "3.5%" not as "3.50%". What do you think?
  4. Petyo
    Admin
    Petyo avatar
    2444 posts

    Posted 06 Mar 2015 Link to this post

    Hi Boris,

    sorry for the misunderstanding. After some further investigation, this turned out to be a bug in our implementation - I am logging it for a fix here.

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Boris Gheihman
    Boris Gheihman avatar
    12 posts
    Member since:
    May 2007

    Posted 06 Mar 2015 Link to this post

    Thanks, Petyo!
Back to Top