Skip to content

DateTimeField._to_python does not work on old dates #142

Closed
@djc

Description

@djc

From megago...@gmail.com on July 19, 2010 23:18:55

What steps will reproduce the problem? 1. test = couchdb.mapping.DateTimeField()
2. test._to_python(u'1880-01-01T00:00:00Z') raises an exception 3. What is the expected output? What do you see instead? It should return a datetime.datetime object.
It raises ValueError: Invalid ISO date/time. What version of the product are you using? On what operating system? couchdb 0.7
python 2.6.4
mac os 10.5 Please provide any additional information below. It is actually the call to datetime.utcfromtimestamp that is raising the exception ValueError: timestamp out of range for platform time_t
Instead of:
timestamp = timegm(strptime(value, '%Y-%m-%dT%H:%M:%S'))
value = datetime.utcfromtimestamp(timestamp)
maybe use this?:
value = datetime.strptime(value, '%Y-%m-%dT%H:%M:%S')

Original issue: http://code.google.com/p/couchdb-python/issues/detail?id=142

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions