Closed jmhansen closed 5 years ago
Thanks for the bug report @jmhansen!
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?
@adamjstewart - this is definitely an edge case!
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: