diff app/model/Zusatzwert.js @ 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 7e801af49eeb
children 1d20cec263ee
line wrap: on
line diff
--- 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];
         }

http://lada.wald.intevation.org