FIX: slightly safer rounding

This commit is contained in:
Joffrey JAFFEUX
2018-06-07 10:59:17 +02:00
committed by GitHub
parent ab089cd68b
commit 1071aa21ab
3 changed files with 5 additions and 2 deletions
@@ -8,7 +8,7 @@ registerUnbound('raw-date', dt => longDate(new Date(dt)));
registerUnbound('age-with-tooltip', dt => new safe(autoUpdatingRelativeAge(new Date(dt), {title: true})));
registerUnbound('number', (orig, params) => {
orig = parseInt(Math.round(orig), 10);
orig = Math.round(parseFloat(orig));
if (isNaN(orig)) { orig = 0; }
let title = I18n.toNumber(orig, { precision: 0 });
@@ -304,7 +304,7 @@ export function relativeAge(date, options) {
export function number(val) {
let formattedNumber;
val = parseInt(Math.round(val), 10);
val = Math.round(parseFloat(val));
if (isNaN(val)) val = 0;
if (val > 999999) {