py-business-calendar
py-business-calendar copied to clipboard
Bug: busdaycount() crashes with IndexError if holiday-list contains only the start date and start date is a busday
this fails:
start = "2019-12-31"
end = "2020-01-07"
Calendar(holidays=["2019-12-31"]).busdaycount(start, end)
but not if:
start = "2019-12-31"
end = "2020-01-07"
Calendar(workdays=[MO, WE], holidays=["2019-12-31"]).busdaycount(start, end)
note: 2019-12-31 is TU 2020-01-01 is WE ... 2020-01-04 is SA ... 2020-01-07 is TU
It also crashes if holiday-list consists of the start date and other non-busdays:
start = "2019-12-31"
end = "2020-01-07"
Calendar(holidays=["2019-12-31", "2020-01-04"]).busdaycount(start, end)
or
start = "2019-12-31"
end = "2020-01-07"
Calendar(holidays=["2019-12-31", "2020-01-04"]).busdaycount(start, end)