Skip to content

ValueError: day is out of range for month #8

@Justintime50

Description

@Justintime50

I'm getting the following for the date 2021/05/07 - I ran the following in the repl and was able to reproduce the issue:

>> import calendar
>>> import datetime
>>> y, m, d = dt.year, dt.month, dt.day
>>> dt = datetime.date(2021, 5, 31) - datetime.timedelta(days=360). # this is what the logic does
>>> y, m, d = dt.year, dt.month, dt.day
>>> datetime.date(y, m, calendar.monthrange(y, m)[0])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: day is out of range for mont

Here is the error though:

Screen Shot 2021-05-07 at 12 06 58 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions