Saleslogix/argos-saleslogix

bigNumber format in argos-saleslogix should work with negative numbers

tlwalla1 opened this issue · 0 comments

Modify the code to allow for negative numbers to be correctly formatted by bigNumber. See below for my implementation:
bigNumber: function(val) {
var numParse = isNaN(val) ? parseFloat(val) : val,
absNumParse = Math.abs(numParse),
text = crm.Format.bigNumberAbbrText;

            if (numParse && absNumParse >= 1000000000) {
                numParse = numParse / 1000000000;
                return dojoNumber.format(numParse, { places: 1 }) + text['billion'];
            } else if (numParse && absNumParse >= 1000000) {
                numParse = numParse / 1000000;
                return dojoNumber.format(numParse, { places: 1 }) + text['million'];
            } else if (numParse && absNumParse >= 1000) {
                numParse = numParse / 1000;
                return dojoNumber.format(numParse, { places: 1 }) + text['thousand'];
            }

            return val;
        }