@stemy/ngx-utils 19.7.5 → 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,14 +3796,14 @@ class FormatterService {
|
|
|
3796
3796
|
precision = this.getPrecision(precision);
|
|
3797
3797
|
minDigits = minDigits ?? precision;
|
|
3798
3798
|
divider = divider || this.defaultDivider;
|
|
3799
|
-
|
|
3800
|
-
const rounded = isNaN(
|
|
3801
|
-
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, {
|
|
3802
3802
|
minimumFractionDigits: minDigits,
|
|
3803
3803
|
maximumFractionDigits: precision,
|
|
3804
3804
|
useGrouping: false
|
|
3805
3805
|
});
|
|
3806
|
-
return ObjectUtils.evaluate(format || this.defaultNumberFormat, { num
|
|
3806
|
+
return ObjectUtils.evaluate(format || this.defaultNumberFormat, { num });
|
|
3807
3807
|
}
|
|
3808
3808
|
formatMillimeter(value, precision, divider) {
|
|
3809
3809
|
return this.formatNumber(value, `num + ' mm'`, precision, divider);
|