some csv feedback

Derek Atkins warlord at MIT.EDU
Mon Jul 9 18:53:46 EDT 2007


Christian Stimming <stimming at tuhh.de> writes:

> Then, I have a conceptual addition with dates. Do you already have plans for 
> different date separators? In the struct date_format_internal there is 
> only '/'.  Eventually, the code needs to take several different date 
> separators into account. I know of 2007/06/05 and 2007-06-05 and 05.06.2007, 
> i.e. the separator is one of [/-.], but there might be others. Maybe 
> http://en.wikipedia.org/wiki/Date_and_time_notation_by_country tells of some, 
> but maybe that page is just a prime example of the wiki principle failing 
> gloriously. Heh :-) 

The QIF code has a decent date parser, although it's in scheme
right now.  The regex looks like:

  "^ *([0-9]+) *[-/.'] *([0-9]+) *[-/.'] *([0-9]+).*$|^ *([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]).*$"

In other words the seperators are a dash (-), slash (/), period (.),
and single quote (').  Also note that there's no requirement that you
use the same separator both times.  E.g. you could use 7/1'07 and this
is a perfectly valid date.

I'd recommend you not ask the user for the date seperator but instead
use a regex and only ask the user to disambiguate d-m-y, m-d-y, y-m-d,
and y-d-m.   Note that these functions can (and should) be shared with
with QIF Rewrite.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list