PynamoDB: _fast_parse_utc_date_string fails on pre year 1000

Python datetime supports dates back to year 0, but _fast_parse_utc_date_string forces datetimes to have four digit years. This resulted in the following error:

ValueError: Datetime string ‘539-02-20T08:36:49.000000+0000’ does not match format ‘%Y-%m-%dT%H:%M:%S.%f%z’

_fast_parse_utc_date_string should fall back to a library call if it fails.

Edit:

My bad, looks like datetime.datetime.strptime('539-02-20T08:36:49.000000+0000', '%Y-%m-%dT%H:%M:%S.%f%z') also fails, meaning isoformat() doesn’t produce parseable datetimes. 😕

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 17 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Yikes, you’re right. This is apparently platform dependent too: https://bugs.python.org/issue13305