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

Client NumberConverter with type=percent ignores maxfractiondigits when formatting

    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

        1. branch121270_2139_maxFracDigits.diff
          1 kB
          Yee-Wah Lee
        2. trunk_2139_numberPercentMaxFrac.diff
          1 kB
          Yee-Wah Lee

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: