py-business-calendar icon indicating copy to clipboard operation
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

Open truderung opened this issue 4 years ago • 1 comments

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

truderung avatar Aug 05 '20 11:08 truderung

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)

truderung avatar Aug 05 '20 12:08 truderung