From b15d0bec8db42feaba38a2bf3e800d1678e82d2b Mon Sep 17 00:00:00 2001 From: Lee Houghton Date: Tue, 8 Apr 2014 15:17:54 +0100 Subject: [PATCH] Fix accidental base-8 parseInt with leading zeroes When a number field has leading zeroes and can be interpreted as an octal number, (e.g. 08), getValue interprets it as an octal number. In the android browser in particular, this parseInt("08"), even more oddly, returns zero! This causes odd "wrapping" behaviour. Always specify a radix when using parseInt! https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt#Octal_interpretations_with_no_radix --- js/bootstrap-formhelpers-number.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/bootstrap-formhelpers-number.js b/js/bootstrap-formhelpers-number.js index 1aa5c6a..085d93f 100644 --- a/js/bootstrap-formhelpers-number.js +++ b/js/bootstrap-formhelpers-number.js @@ -192,7 +192,7 @@ value = this.options.min; } - return parseInt(value); + return parseInt(value, 10); }, formatNumber: function() {