Date or Date-and-time for transactions

Derek Atkins derek at ihtfp.com
Fri Nov 30 12:49:48 EST 2012


On Fri, November 30, 2012 10:38 am, Buddha Buck wrote:
> On Fri, Nov 30, 2012 at 10:09 AM, Derek Atkins <warlord at mit.edu> wrote:
>>> Right. Since ISO8601 specifies that date-times are converted to UTC
>>> (Z), we currently convert to-and-from the local TZ when we instantiate
>>> objects with a Timespec field. I'm saying we should stop doing that
>>> and just use UTC for timestamps. This has the added benefit of making
>>> unnecessary the GTimeZone workarounds for MSWin, all of the messiness
>>> associated with DST, and a boatload of code.
>>
>> Actually, the XML file stores times as local times.  Here's an example
>> from my data file:
>>
>>   <trn:date-posted>
>>     <ts:date>2007-01-01 00:00:00 -0500</ts:date>
>>   </trn:date-posted>
>>   <trn:date-entered>
>>     <ts:date>2007-08-13 15:15:22 -0400</ts:date>
>>   </trn:date-entered>
>
> My understanding of ISO8601 suggests that this isn't even a valid
> ISO8601 format;  I believe the entered date should be
> "2007-08-13T15:15:22-0400" in valid ISO8601 format.

I'm afraid your understanding is incorrect.  ISPO 8601-2004(E), section
4.3.2 states:  NOTE: By mutual agreement of the partners in information
interchange, the character [T] may be omitted in applications where there
is no risk of confusing a date and time of day representation with others
defined in this International Standard.

So what we have is perfectly legal ISO8601 because there is no confusion
between the date and time of day.

> However, ISO8601 doesn't require the time portion, so if we are just
> interested in the date-posted, it would make sense to store it as the
> valid ISO8601 formatted "2007-01-01" and not worry about if it's noon
> or midnight (or some other time).

This is true, but it's unclear what our parser requires.   The real
problem is that we need to make sure that older versions of gnucash can
get the semantics of the updated data file correct.  I don't know what
gnucash 2.4.11 would do if the time portion was dropped.  I suppose I (or
someone else) could try it and see?

-derek

-- 
       Derek Atkins                 617-623-3745
       derek at ihtfp.com             www.ihtfp.com
       Computer and Internet Security Consultant



More information about the gnucash-devel mailing list