gnucash maint: Bug 798547 - Calculated Due Date is short 1 day when posting on...

John Ralls jralls at code.gnucash.org
Thu Jun 2 18:51:10 EDT 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/903cbdca (commit)
	from  https://github.com/Gnucash/gnucash/commit/b218926e (commit)



commit 903cbdcad34e6a73041442ec1bcd90103572cdd9
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Jun 2 15:46:59 2022 -0700

    Bug 798547 - Calculated Due Date is short 1 day when posting on...
    
    day of fall change from Daylight Time to Standard Time.
    
    Really any day where the period crosses the dst->std change, and
    since the date dialog returns local midnight for the time that includes
    the day of the change.
    
    Convert both the parameter time and the return time to neutral time
    to ensure that the interval is handled correctly.

diff --git a/libgnucash/engine/gncBillTerm.c b/libgnucash/engine/gncBillTerm.c
index fb6f2bb15..3338b1433 100644
--- a/libgnucash/engine/gncBillTerm.c
+++ b/libgnucash/engine/gncBillTerm.c
@@ -800,20 +800,21 @@ compute_monthyear (const GncBillTerm *term, time64 post_date,
 static time64
 compute_time (const GncBillTerm *term, time64 post_date, int days)
 {
-    time64 res = post_date;
+    time64 res = gnc_time64_get_day_neutral (post_date);
     int day, month, year;
 
     switch (term->type)
     {
     case GNC_TERM_TYPE_DAYS:
         res += (SECS_PER_DAY * days);
+        res = gnc_time64_get_day_neutral (res);
         break;
     case GNC_TERM_TYPE_PROXIMO:
         compute_monthyear (term, post_date, &month, &year);
         day = gnc_date_get_last_mday (month - 1, year);
         if (days < day)
             day = days;
-        res = gnc_dmy2time64 (day, month, year);
+        res = gnc_dmy2time64_neutral (day, month, year);
         break;
     }
     return res;



Summary of changes:
 libgnucash/engine/gncBillTerm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list