Uploaded image for project: 'MyFaces Trinidad'
  1. MyFaces Trinidad
  2. TRINIDAD-2139

Client NumberConverter with type=percent ignores maxfractiondigits when formatting

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.0-core
    • 2.0.1-core
    • Components
    • None

    Description

      NumberFormat.js contains the following code:
      TrNumberFormat.prototype.percentageToString = function(number)
      {
      number = number * 100;
      number = this.getRounded(number);
      .. number = this.numberToString(number);
      }

      consideration the number of fractionDigits but numberToString later will.
      TrNumberFormat.prototype.getRounded = function(val)
      {
      val = this.moveDecimalRight(val);
      val = Math.round(val);
      val = this.moveDecimalLeft(val);
      return val;
      }

      Math.round function will round to the nearest integer. With the earlier multiplication to 100, precision is preserved to at most two digits, regardless of the maxFractionDigits attribute.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            gabrielle Gabrielle Crawford
            yeelee Yee-Wah Lee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment