OFX Import Bug

Thomas Baumgart thb at net-bembel.de
Fri Jan 13 09:36:40 UTC 2017


Hi,

On Thursday 12 January 2017 09:38:25 Brendan Coupe wrote:

> My mistake, I meant DTEND not DTSTOP.

:)

> 1) Bank that is off by 1 day:
> 
> ofxlog.txt: <DTEND>20170111000000.000
> kmm-statement-0.txt: enddate="2017-01-10"
> KMM Ledger: Online Statement Balance - 2017.01.10
> 
> 2) Bank the reports 1969.12.31
> 
> ofxlog.txt: DTEND is not included in this file
> kmm-statement-0.txt: enddate="1969-12-31"
> KMM Ledger: Online Statement Balance -
> 
> 3) Banks that work (I checked a few):
> 
> ofxlog.txt: <DTEND>20170112120000
> kmm-statement-0.txt: enddate="2017-01-12"
> KMM Ledger: Online Statement Balance - 2017.01.12
> 
> It appears that Thomas my be right that this is a time zone issue. I'm in
> California and the bank that works reports noon of the correct day. The
> bank that is off reports midnight and if you assume that is GMT then it's
> the day before in California. The bank that does not include the DTEND
> value appears to assume midnight on 1970.01.01 which if assumed to be GMT
> is 1969.12.31 in California.
> 
> I think it makes sense to use noon since noon GMT is the only time that i't
> that same day everywhere.
> 
> Note that one bank had <DTEND>20170112050000.000[-7:MST]. MST = Mountain
> Standard Time, one time zone east of California (PST which is -8). Not
> surprisingly, 05 MST = 12 GMT. I thought it would be good for you to know
> that sometimes they include the time zone. This bank was handled correctly
> (enddate="2017-01-12") so you probably already use the time zone info if
> it's included.

Thanks for the detailed analysis. I think it hits the nail right on the head. 
Date and timezone handling is all done by libOFX (I fixed something myself in 
that are sometime ago - wow 7 years: 
https://github.com/libofx/libofx/commit/166b97964de3ed3986346f8844d8029ca11e3d79, 
the internet does not forget)

Not sure what we can do about it since all that is handled by libOFX AFAIR. 
One thing I could think of is to add a 'Treat date/time values from bank as 
local times' somewhere in the OFX settings for a bank. If that is set, the 
offset of the timezone will subtracted from the time provided to KMyMoney. In 
your case:

> ofxlog.txt: <DTEND>20170111000000.000
> kmm-statement-0.txt: enddate="2017-01-10"
> KMM Ledger: Online Statement Balance - 2017.01.10

it would cause to subtract -9 hrs (which adds 9 hrs) from the timestamp in 
DTEND and thus yielding the 11th for KMyMoney again (hopefully).

This still leaves the handling for the end dates prior to the start dates 
which will be special in any case, with or without timezone information.

-- 

Regards

Thomas Baumgart

GPG-FP: E55E D592 F45F 116B 8429   4F99 9C59 DB40 B75D D3BA
-------------------------------------------------------------
An optimist laughs to forget.
A pessimist forgets to laugh.
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 225 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20170113/4990cc29/attachment.sig>


More information about the KMyMoney-devel mailing list