pyxero
pyxero copied to clipboard
Date handling appears to be messed up
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?
Xero date formatting is crappy. Especially in that case, where the field name contains UTC, but the value clearly isn't!
As far as I can tell from debugging, the weird string values are coming from Xero's JSON data.
Aha, documented: http://developer.xero.com/documentation/advanced-docs/dates-and-timestamps-explained/
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.
Well, I'm trying to set the date of a payment to the due date of an invoice.
Thankfully there appears to be a DateString I can use in the mean time, but it's not quite the same.
I do have some code that (I believe correctly) interprets these values, but it's not pretty.