pyxero icon indicating copy to clipboard operation
pyxero copied to clipboard

Date handling appears to be messed up

Open taralx opened this issue 9 years ago • 7 comments

I'm seeing invoices where the date comes in as u'UpdatedDateUTC': u'/Date(1451988985943+1300)/' -- which doesn't work as something you can send back. Any ideas?

taralx avatar Jan 05 '16 23:01 taralx

Xero date formatting is crappy. Especially in that case, where the field name contains UTC, but the value clearly isn't!

schinckel avatar Jan 05 '16 23:01 schinckel

As far as I can tell from debugging, the weird string values are coming from Xero's JSON data.

taralx avatar Jan 05 '16 23:01 taralx

Aha, documented: http://developer.xero.com/documentation/advanced-docs/dates-and-timestamps-explained/

taralx avatar Jan 05 '16 23:01 taralx

In that particular case, you won't want to be sending back that field, because it will prevent saving: the value will be updated by Xero when you make changes.

schinckel avatar Jan 05 '16 23:01 schinckel

Well, I'm trying to set the date of a payment to the due date of an invoice.

taralx avatar Jan 05 '16 23:01 taralx

Thankfully there appears to be a DateString I can use in the mean time, but it's not quite the same.

taralx avatar Jan 05 '16 23:01 taralx

I do have some code that (I believe correctly) interprets these values, but it's not pretty.

schinckel avatar Jan 05 '16 23:01 schinckel