gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Sun Aug 21 05:27:25 EDT 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/b7a3652d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/96420257 (commit)
	from  https://github.com/Gnucash/gnucash/commit/1b384df6 (commit)



commit b7a3652de74bd5245ebf807e089de41d68147fa4
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Aug 21 16:52:13 2022 +0800

    [date-utilities] avoid report crash if start>end date

diff --git a/libgnucash/app-utils/date-utilities.scm b/libgnucash/app-utils/date-utilities.scm
index d55c410ea..3901ccfe8 100644
--- a/libgnucash/app-utils/date-utilities.scm
+++ b/libgnucash/app-utils/date-utilities.scm
@@ -339,6 +339,11 @@
     (assv-ref MonthDeltas incr))
   (define (make-interval from to)
     (list from (if (< to enddate) (decdate to SecDelta) enddate)))
+  (when (< enddate startdate)
+    (let ((saved-enddate enddate))
+      (gnc:warn "start > end date. Swapping dates to avoid some reports crashing.")
+      (set! enddate startdate)
+      (set! startdate saved-enddate)))
   (let loop ((result '())
              (date startdate)
              (idx 0))
@@ -365,6 +370,11 @@
 (define (gnc:make-date-list startdate enddate incr)
   (define month-delta
     (assv-ref MonthDeltas incr))
+  (when (< enddate startdate)
+    (let ((saved-enddate enddate))
+      (gnc:warn "start > end date. Swapping dates to avoid some reports crashing.")
+      (set! enddate startdate)
+      (set! startdate saved-enddate)))
   (let loop ((result '())
              (date startdate)
              (idx 0))

commit 9642025745e96263c48abf2468757433c9e6740e
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Aug 21 16:48:59 2022 +0800

    [html-chart] add percent formatter for numbers for older javascript
    
    addendum to f99168064 for win32 builds

diff --git a/gnucash/report/html-chart.scm b/gnucash/report/html-chart.scm
index f9fa7f520..344bc6239 100644
--- a/gnucash/report/html-chart.scm
+++ b/gnucash/report/html-chart.scm
@@ -351,8 +351,12 @@ var toLocaleStringSupportsOptions = (typeof Intl == 'object' && Intl && typeof I
 function numformat(amount) {
   if (toLocaleStringSupportsOptions) {
       return amount.toLocaleString(undefined, {style:formsty, currency:curriso});
-  } else {
+  } else if (formsty == 'percent') {
+      return (100 * amount).toLocaleString() + '%';
+  } else if (formsty == 'currency') {
       return currsym + amount.toLocaleString();
+  } else {
+      return amount.toLocaleString();
   }
 }
 ")



Summary of changes:
 gnucash/report/html-chart.scm           |  6 +++++-
 libgnucash/app-utils/date-utilities.scm | 10 ++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list