@stemy/ngx-utils 19.7.4 → 19.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3796,13 +3796,14 @@ class FormatterService {
|
|
|
3796
3796
|
precision = this.getPrecision(precision);
|
|
3797
3797
|
minDigits = minDigits ?? precision;
|
|
3798
3798
|
divider = divider || this.defaultDivider;
|
|
3799
|
-
|
|
3800
|
-
const
|
|
3799
|
+
value = (ObjectUtils.isNumber(value) ? value : parseFloat(value) ?? 0) / divider;
|
|
3800
|
+
const rounded = isNaN(value) || Math.abs(value) < EPSILON ? 0 : MathUtils.round(value, 10);
|
|
3801
|
+
const num = rounded.toLocaleString(this.language.currentLanguage, {
|
|
3801
3802
|
minimumFractionDigits: minDigits,
|
|
3802
3803
|
maximumFractionDigits: precision,
|
|
3803
3804
|
useGrouping: false
|
|
3804
3805
|
});
|
|
3805
|
-
return ObjectUtils.evaluate(format || this.defaultNumberFormat, { num
|
|
3806
|
+
return ObjectUtils.evaluate(format || this.defaultNumberFormat, { num });
|
|
3806
3807
|
}
|
|
3807
3808
|
formatMillimeter(value, precision, divider) {
|
|
3808
3809
|
return this.formatNumber(value, `num + ' mm'`, precision, divider);
|