mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
number format isn't localized #437
This commit is contained in:
parent
a16de19ee7
commit
4de9b614dc
@ -459,6 +459,11 @@ class Utils
|
|||||||
|
|
||||||
public static function parseFloat($value)
|
public static function parseFloat($value)
|
||||||
{
|
{
|
||||||
|
// check for comma as decimal separator
|
||||||
|
if (preg_match('/,[\d]{1,2}$/', $value)) {
|
||||||
|
$value = str_replace(',', '.', $value);
|
||||||
|
}
|
||||||
|
|
||||||
$value = preg_replace('/[^0-9\.\-]/', '', $value);
|
$value = preg_replace('/[^0-9\.\-]/', '', $value);
|
||||||
|
|
||||||
return floatval($value);
|
return floatval($value);
|
||||||
|
@ -27,8 +27,18 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
NINJA.parseFloat = function(str) {
|
NINJA.parseFloat = function(str) {
|
||||||
if (!str) return '';
|
if (! str) {
|
||||||
str = (str+'').replace(/[^0-9\.\-]/g, '');
|
return '';
|
||||||
|
} else {
|
||||||
|
str = str + '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for comma as decimal separator
|
||||||
|
if (str.match(/,[\d]{1,2}$/)) {
|
||||||
|
str = str.replace(',', '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
str = str.replace(/[^0-9\.\-]/g, '');
|
||||||
|
|
||||||
return window.parseFloat(str);
|
return window.parseFloat(str);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user