From 88949dc3e4695d10813bb60b59688d87ad6d5584 Mon Sep 17 00:00:00 2001 From: Matthias B Date: Tue, 18 Aug 2020 19:43:50 +0200 Subject: [PATCH] Make product amount picker locale independent (#876) Since the value of $('#amount') will be written to the database it should not be locale dependent. This code also limits the result to a maximum of 4 digits but always uses a dot as decimal separator. --- public/viewjs/components/productamountpicker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/viewjs/components/productamountpicker.js b/public/viewjs/components/productamountpicker.js index 147473f2..c451c2fd 100644 --- a/public/viewjs/components/productamountpicker.js +++ b/public/viewjs/components/productamountpicker.js @@ -83,7 +83,7 @@ $(".input-group-productamountpicker").on("change", function() $("#qu-conversion-info").text(__t("This equals %1$s %2$s in stock", destinationAmount.toLocaleString(), destinationQuName)); } - $("#amount").val(destinationAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 })); + $("#amount").val(destinationAmount.toFixed(4).replace(/0*$/g,'')); }); $("#display_amount").on("keyup", function()