Bizdays is returning the wrong date. Is my calendar broken?

50 views Asked by At

I'm trying to get previous business days (and previous previous business days) using the bizdays package so that I can use it later. However for some reason the two objects I want to create seem to only returning today's date nomatter what function I use.

The code is below:

yr_plus_1 <- lubridate::year(Sys.Date()) + 1
    holidays <- lubridate::ymd(timeDate::holidayLONDON(2019:yr_plus_1))
    cal <- create.calendar(name = "MyCalendar", holidays = holidayLONDON(), weekdays=c("saturday", "sunday"), financial = FALSE)
    ## Get prev business day(s)
    prev_buisness_day <- modified.preceding(as.Date(Sys.time()), "MyCalendar")
    prev_prev_businesss_day <- modified.preceding(prev_buisness_day, cal)

Could it be my calendar is going wrong? Any advice is greatly appreciated.

0

There are 0 answers