You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "<input>", line 3, in <module>
File "/site-packages/fiscalyear.py", line 594, in quarter
if self in q:
File "/site-packages/fiscalyear.py", line 413, in __contains__
return self.start.date() <= item <= self.end.date()
File "/site-packages/fiscalyear.py", line 493, in end
next_start = self.next_quarter.start
File "/site-packages/fiscalyear.py", line 485, in start
return FiscalDateTime(year, month, START_DAY, 0, 0, 0)
ValueError: day is out of range for month
The quarters generated are:
December 31st
March 31st
June 31st ← Not a valid day, so it breaks.
The text was updated successfully, but these errors were encountered:
Are there any countries/businesses who actually use a fiscal calendar that starts on the 31st of any month, or is this just a theoretical bug? Either way I'm happy to fix it. What do you think the desired behavior should be? Should it choose the 30th of the month (or 28th if February), or the 1st of the next month?
I don't know of a company that actually has a fiscal calendar start on the 31st, but we allow users to submit any date, and at least two different users have accidentally submitted the end of year as December 30th, making the 31st the start of their year.
(There is certainly more validation I can do to prevent this, but I do like that this package does aim to handle any fiscal calendar range.)
I think the desired outcome would be to have each quarter start on the last day of the month rather than the 1st of the next month. If someone wants a wonky fiscal calendar, they can have it!
If the
FiscalCalendar
starts on the 31st of any month with 31 days, thenFiscalDate().quarter
throws aValueError
.Example code:
Traceback:
The quarters generated are:
The text was updated successfully, but these errors were encountered: