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.
This commit is contained in:
John Ralls
2023-11-26 09:23:58 -08:00
parent c07e0890f2
commit 92de074e49

View File

@@ -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;