Gnucash BugTrack notification

new message incoming/93

Message summary for PR#93
        From: [EMAIL PROTECTED]
        Subject: xaccParseQIFDate tends to get non-US dates wrong
        Date: unknown
        0 replies       0 followups

====> ORIGINAL MESSAGE FOLLOWS <====

Received: (qmail 13001 invoked from network); 29 Feb 2000 04:23:08 -0000
Received: from localhost (127.0.0.1)
  by localhost with SMTP; 29 Feb 2000 04:23:08 -0000
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: xaccParseQIFDate tends to get non-US dates wrong

Full_Name: Martin Schwenke
Version: 1.3.0
GUI: gnucash-gnome
OS: Debian GNU/Linux (potato) - kernel 2.2.14
Submission from: (NULL) (203.29.91.49)


The date parsing in xaccParseQIFDate assumes US date format as a default.
In date.c, scanDate seems to do a better job, although the return values need
to be slightly hacked:

scanDate(str, &dat.tm_mday, &dat.tm_mon, &dat.tm_year);
dat.tm_mon  -= 1;
dat.tm_year -= 1900;

A complete patch appears at the end.

Also, the "all dates are 1970" bug seems to happen when the QIF data contains
4 digit years.

peace & happiness,
martin

*** QIFIO.c     2000/02/29 03:34:49     1.1
--- QIFIO.c     2000/02/29 04:11:51
***************
*** 40,45 ****
--- 40,46 ----
  #include "config.h"
  
  #include "Account.h"
+ #include "date.h"
  #include "Group.h"
  #include "FileIO.h"
  #include "Transaction.h"
***************
*** 420,425 ****
--- 421,432 ----
  
     if (!str) return 0;  /* If the string is null, we're done. */
  
+    /* Try using the scanDate function to scan the date more sensibly! */
+    scanDate(str, &dat.tm_mday, &dat.tm_mon, &dat.tm_year);
+    dat.tm_mon  -= 1;
+    dat.tm_year -= 1900;
+ 
+ #if 0
     /* First, figure out the delimiter. */
     /* Choices: "." or "-" or "/" */
     favechar = FindDateDelimiter(str);
***************
*** 444,449 ****
--- 451,457 ----
     }
     *tok = 0x0;
     dat.tm_year = atoi (str);
+ #endif
  
     TryToFixDate(&dat);
  




--
Gnucash Developer's List 
To unsubscribe send empty email to: [EMAIL PROTECTED]

Reply via email to