From 92de074e496b3e37493689e5aa06c3e094cfe22a Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 26 Nov 2023 09:23:58 -0800 Subject: [PATCH] Bug 799144 - Date Completion is broken after 5.4 upgrade strptime will reasonable return false for an incomplete date but it still fills in the parts of the struct tm that it understands, so bail out of qof_scan_date_internal when it fails only if all three fields are present. --- libgnucash/engine/gnc-date.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libgnucash/engine/gnc-date.cpp b/libgnucash/engine/gnc-date.cpp index 80b309edfb..8c202e40e4 100644 --- a/libgnucash/engine/gnc-date.cpp +++ b/libgnucash/engine/gnc-date.cpp @@ -756,11 +756,11 @@ qof_scan_date_internal (const char *buff, int *day, int *month, int *year, char *strv = strptime (buff, normalize_format(GNC_D_FMT).c_str(), &thetime); - if (!strv) // Parse failed, continuing gives the wrong result. - return FALSE; - if (third_field) { + if (!strv) // Parse failed, continuing gives the wrong result. + return FALSE; + /* Easy. All three values were parsed. */ iyear = thetime.tm_year + 1900; iday = thetime.tm_mday;