Message397329
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. |
|
Date |
User |
Action |
Args |
2021-07-12 15:23:50 | bkaznowski | set | recipients:
+ bkaznowski |
2021-07-12 15:23:50 | bkaznowski | set | messageid: <1626103430.53.0.693000893049.issue44610@roundup.psfhosted.org> |
2021-07-12 15:23:50 | bkaznowski | link | issue44610 messages |
2021-07-12 15:23:50 | bkaznowski | create | |
|