gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Mar 25 12:16:38 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/9cd22ee6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a670238f (commit)
	from  https://github.com/Gnucash/gnucash/commit/2b6047f9 (commit)



commit 9cd22ee66766f0f188becf6489cd1c87446d5262
Merge: 2b6047f a670238
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Mar 25 09:02:43 2018 -0700

    Merge Chris Lam's Fix-794030 into maint


commit a670238f80a92552f7b4771be424f7fc382df69b
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Mar 25 15:47:35 2018 +0800

    Bug 794030 - relative date functions compute wrong day of month
    
    Convert > to < and rename month-length to month-days for consistency.

diff --git a/src/app-utils/date-utilities.scm b/src/app-utils/date-utilities.scm
index 72eb0f3..5ecd844 100644
--- a/src/app-utils/date-utilities.scm
+++ b/src/app-utils/date-utilities.scm
@@ -718,10 +718,10 @@
 	  (set-tm:mon now 11)
 	  (set-tm:year now (- (tm:year now) 1)))
 	(set-tm:mon now (- (tm:mon now) 1)))
-    (let ((month-length (gnc:days-in-month (+ (tm:mon now) 1)
-                                           (+ (tm:year now) 1900))))
-      (if (> month-length (tm:mday now))
-	  (set-tm:mday now month-length))
+    (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
+                                         (+ (tm:year now) 1900))))
+      (if (< month-days (tm:mday now))
+	  (set-tm:mday now month-days))
       (set-tm:isdst now -1)
       (gnc:date->timepair now))))
 
@@ -734,7 +734,7 @@
     (set:tm-mon now (- (tm:mon now) 3))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
                                          (+ (tm:year now) 1900))))
-      (if (> month-days (tm:mday now))
+      (if (< month-days (tm:mday now))
 	  (set-tm:mday now month-days))
       (set-tm:isdst now -1)
       (gnc:date->timepair now))))
@@ -748,7 +748,7 @@
     (set:tm-mon now (- (tm:mon now) 6))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
                                          (+ (tm:year now) 1900))))
-      (if (> month-days (tm:mday now))
+      (if (< month-days (tm:mday now))
 	  (set-tm:mday now month-days))
       (set-tm:isdst now -1)
       (gnc:date->timepair now))))
@@ -757,8 +757,8 @@
   (let ((now (gnc-localtime (current-time))))
     (set:tm-year now (- (tm:year now) 1))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
-                                          (+ (tm:year now) 1900))))
-      (if (> month-days (tm:mday now))
+                                         (+ (tm:year now) 1900))))
+      (if (< month-days (tm:mday now))
 	  (set-tm:mday now month-days))
       (set-tm:isdst now -1)
       (gnc:date->timepair now))))
@@ -770,10 +770,10 @@
 	  (set-tm:mon now 0)
 	  (set-tm:year now (+ (tm:year now) 1)))
 	(set-tm:mon now (+ (tm:mon now) 1)))
-    (let ((month-length (gnc:days-in-month (+ (tm:mon now) 1)
-                                           (+ (tm:year now) 1900))))
-      (if (> month-length (tm:mday now))
-	  (set-tm:mday now month-length))
+    (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
+                                         (+ (tm:year now) 1900))))
+      (if (< month-days (tm:mday now))
+	  (set-tm:mday now month-days))
       (set-tm:isdst now -1)
       (gnc:date->timepair now))))
 
@@ -783,10 +783,10 @@
 	(begin
 	  (set:tm-mon now (- (tm:mon now) 9))
 	  (set:tm-year now  (+ (tm:year now) 1))
-       (set:tm-mon now (+ (tm:mon now) 3))))
+          (set:tm-mon now (+ (tm:mon now) 3))))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
                                          (+ (tm:year now) 1900))))
-      (if (> month-days (tm:mday now))
+      (if (< month-days (tm:mday now))
 	  (set-tm:mday now month-days))
       (set-tm:isdst now -1)
       (gnc:date->timepair now))))
@@ -797,10 +797,10 @@
 	(begin
 	  (set:tm-mon now (- (tm:mon now) 6))
 	  (set:tm-year now  (+ (tm:year now) 1))
-       (set:tm-mon now (+ (tm:mon now) 6))))
+          (set:tm-mon now (+ (tm:mon now) 6))))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
                                          (+ (tm:year now) 1900))))
-      (if (> month-days (tm:mday now))
+      (if (< month-days (tm:mday now))
 	  (set-tm:mday now month-days))
       (set-tm:isdst now -1)
       (gnc:date->timepair now))))
@@ -809,8 +809,8 @@
   (let ((now (gnc-localtime (current-time))))
     (set:tm-year now (+ (tm:year now) 1))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
-                                          (+ (tm:year now) 1900))))
-      (if (> month-days (tm:mday now))
+                                         (+ (tm:year now) 1900))))
+      (if (< month-days (tm:mday now))
 	  (set-tm:mday now month-days))
       (set-tm:isdst now -1)
       (gnc:date->timepair now))))



Summary of changes:
 src/app-utils/date-utilities.scm | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)



More information about the gnucash-changes mailing list