Skip to content

Datetimes become timezone aware #918

@CosmicAnalogue465

Description

@CosmicAnalogue465

If I serialize a object using to_json with timezone unaware dates and then load them back with from_json, the datetime object is then timezone aware.

class TestDoc(Document):
    d = DateTimeField()

a = TestDoc()
a.d = datetime.now()

print a.d  # 2015-03-29 11:12:53.963929
a = TestDoc.from_json(a.to_json())
print a.d  # 2015-03-29 11:12:53.963000+00:00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions