Author bkaznowski
Recipients bkaznowski
Date 2021-07-12.15:23:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1626103430.53.0.693000893049.issue44610@roundup.psfhosted.org>
In-reply-to
Content
When you convert a date pre the year 1000 to a string with `%Y` as the formatter and then back to a date again then it fails. This is because `%Y` expects it to be formatted with leading zeroes. For example, the year 1/01/01 (yyyy/mm/dd) should be 0001/01/01 when formatting using %Y/%m/%d. However, %Y returns 1.
You can see this in action here:

from datetime import date, datetime
format = "%Y-%m-%d"
formatted = date.min.strftime("%Y-%m-%d")
datetime.strptime(formatted, format).date()

`ValueError: time data '1-01-01' does not match format '%Y-%m-%d'` is raised on the forth line.
History
Date User Action Args
2021-07-12 15:23:50bkaznowskisetrecipients: + bkaznowski
2021-07-12 15:23:50bkaznowskisetmessageid: <1626103430.53.0.693000893049.issue44610@roundup.psfhosted.org>
2021-07-12 15:23:50bkaznowskilinkissue44610 messages
2021-07-12 15:23:50bkaznowskicreate