Mercurial > lada > lada-client
changeset 1065:7fa853864d9b
show trailing '0' in exponential notation.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 10 Mar 2016 10:45:50 +0100 |
parents | cc17de34c689 |
children | d198946e5540 |
files | app/model/Messwert.js app/model/Zusatzwert.js |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/app/model/Messwert.js Wed Mar 09 16:27:58 2016 +0100 +++ b/app/model/Messwert.js Thu Mar 10 10:45:50 2016 +0100 @@ -59,7 +59,8 @@ var parts = tmp.split('e'); if (parts[0].indexOf('.') > 0) { var floatPart = parseFloat(parts[0]); - parts[0] = floatPart.toLocaleString(); + var separator = floatPart.toLocaleString().replace(/[-\d]/g, ''); + parts[0] = floatPart.toFixed(3).replace('.', separator); } return parts[0] + 'e' + parts[1]; }
--- a/app/model/Zusatzwert.js Wed Mar 09 16:27:58 2016 +0100 +++ b/app/model/Zusatzwert.js Thu Mar 10 10:45:50 2016 +0100 @@ -56,7 +56,8 @@ var parts = tmp.split('e'); if (parts[0].indexOf('.') > 0) { var floatPart = parseFloat(parts[0]); - parts[0] = floatPart.toLocaleString(); + var separator = floatPart.toLocaleString().replace(/[-\d]/g, ''); + parts[0] = floatPart.toFixed(3).replace('.', separator); } return parts[0] + 'e' + parts[1]; } @@ -91,7 +92,8 @@ var parts = tmp.split('e'); if (parts[0].indexOf('.') > 0) { var floatPart = parseFloat(parts[0]); - parts[0] = floatPart.toLocaleString(); + var separator = floatPart.toLocaleString().replace(/[-\d]/g, ''); + parts[0] = floatPart.toFixed(3).replace('.', separator); } return parts[0] + 'e' + parts[1]; }