From 903cbdcad34e6a73041442ec1bcd90103572cdd9 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Thu, 2 Jun 2022 15:46:59 -0700 Subject: [PATCH] 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. --- libgnucash/engine/gncBillTerm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libgnucash/engine/gncBillTerm.c b/libgnucash/engine/gncBillTerm.c index fb6f2bb15c..3338b1433f 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;