gnucash future: [html-chart.scm] use modern JS to format currency amounts
Christopher Lam
clam at code.gnucash.org
Sat Aug 22 18:02:58 EDT 2026
Updated via https://github.com/Gnucash/gnucash/commit/39c1024f (commit)
from https://github.com/Gnucash/gnucash/commit/09ea2ae4 (commit)
commit 39c1024f8737811746ce6d278baaec5032e2e16d
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Aug 23 06:01:37 2026 +0800
[html-chart.scm] use modern JS to format currency amounts
diff --git a/gnucash/report/html-chart.scm b/gnucash/report/html-chart.scm
index 541495c135..94160fdeb9 100644
--- a/gnucash/report/html-chart.scm
+++ b/gnucash/report/html-chart.scm
@@ -351,19 +351,10 @@
(define JS-Number-to-String "
// The following snippet from MDN
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
-var toLocaleStringSupportsOptions = (typeof Intl == 'object' && Intl && typeof Intl.NumberFormat == 'function');
// format a number e.g. 2.5 into monetary e.g. \"$2.50\" or other style formsty
function numformat(amount) {
- if (toLocaleStringSupportsOptions) {
- return amount.toLocaleString(undefined, {style:formsty, currency:curriso});
- } else if (formsty == 'percent') {
- return (100 * amount).toLocaleString() + '%';
- } else if (formsty == 'currency') {
- return currsym + amount.toLocaleString();
- } else {
- return amount.toLocaleString();
- }
+ return amount.toLocaleString(undefined, {style:formsty, currency:curriso});
}
")
Summary of changes:
gnucash/report/html-chart.scm | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
More information about the gnucash-changes
mailing list