From 4e07ab9e561561da7c7c9b8a4175311ba88fbd6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 23 May 2025 12:53:44 +0200 Subject: [PATCH] Remove thousand separator when converting domain string to float Since c8d97fac the domain parser format number using locale but the atof function does not remove the thousand separator which could prevent Number to parse the string. Closes #14024 (grafted from dc438f32fa7887e5e0e241a6154a1c685e9cda20) --HG-- branch : 7.0 --- sao/src/common.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sao/src/common.js b/sao/src/common.js index d0ddae321a..ad66ccf082 100644 --- a/sao/src/common.js +++ b/sao/src/common.js @@ -2025,8 +2025,13 @@ } let { format } = new Intl.NumberFormat( Sao.i18n.BC47(Sao.i18n.getlang())); + // use 10000 because some language (ex: es) add thousand + // separator only after 9999 + let [, thousandSeparator] = /^10(.)?000/.exec(format(10000)); let [, decimalSign] = /^0(.)1$/.exec(format(0.1)); - return Number(string.replace(decimalSign, '.')); + return Number(string + .replace(new RegExp(thousandSeparator, 'g'), '') + .replace(decimalSign, '.')); } var convert_selection = function() { if (typeof value == 'string') {