Skip to content

Cloud Api -- ISO 8601 - RFC 3339 Format ?  #34

Description

@david-bergman

I had to modify the code in the deserializer.py on line 216, as the api is returning the datetime in the ISO 8601 format, it seemed to only work when I convert the date into the RFC 3339, so including the Z at the end...

not sure if there is a way in the XERO configuration to specify the date format to be returned in the API?

This is using the Demo account, as I am trying to just get a feel for the API..

if data is not None:
    try:
        dt = isoparse(data[:16] + 'Z')
    except (ValueError, TypeError):
        raise ValueError("Invalid datetime value {!r}".format(data[:16] + 'Z'))

    if not dt.tzinfo:
        # timezone naive datetime from Xero API response always in UTC
        dt = dt.replace(tzinfo=tz.UTC)

    return dt

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions