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

Wrong behavior in TrNumberFormat

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.2.13-core
    • 1.2.15-core
    • Components
    • None
    • Environment independent.

    Description

      Currently implementation of formatting a fraction part of a number is shown below: when maxFra is the same as minFra, and facsLength is larger than maxFra, the number will not be formatted correctly.

      TrNumberFormat.prototype._formatFractions = function(fracs)
      {
      var fracsLength = fracs.length;
      var maxFra = this.getMaximumFractionDigits();
      var minFra = this.getMinimumFractionDigits();

      if(fracsLength > maxFra && maxFra>minFra)

      { fracs = fracs.substring(0, maxFra); }

      if(fracsLength <minFra)
      {
      var gap = minFra-fracsLength;

      //we need to add some zeros
      while(gap>0)

      { fracs = fracs + "0"; --gap; }

      }
      return fracs;
      }

      The 7th line of the above code should be:

      if(fracsLength > maxFra && maxFra >= minFra)

      Attachments

        1. numberformat.patch
          0.4 kB
          Jing Wu

        Activity

          People

            Unassigned Unassigned
            jingwu Jing Wu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: