Use properly formatted numbers "everywhere" (partly references #389)

This commit is contained in:
Bernd Bestel
2019-09-26 15:25:30 +02:00
parent 7369603d78
commit 21503c26d2
14 changed files with 39 additions and 24 deletions

View File

@@ -528,18 +528,33 @@ $("#about-dialog-link").on("click", function()
function RefreshLocaleNumberDisplay()
{
$(".locale-number-format[data-format='currency']").each(function()
$(".locale-number.locale-number-currency").each(function()
{
if (isNaN(parseFloat($(this).text())))
{
return;
}
$(this).text(parseFloat($(this).text()).toLocaleString(undefined, { style: "currency", currency: Grocy.Currency }));
});
$(".locale-number-format[data-format='quantity-amount']").each(function()
$(".locale-number.locale-number-quantity-amount").each(function()
{
if (isNaN(parseFloat($(this).text())))
{
return;
}
$(this).text(parseFloat($(this).text()).toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 3 }));
});
$(".locale-number-format[data-format='generic']").each(function ()
$(".locale-number.locale-number-generic").each(function ()
{
if (isNaN(parseFloat($(this).text())))
{
return;
}
$(this).text(parseFloat($(this).text()).toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 2 }));
});
}