In my setup, weekdays(Sys.Date() + 0:6) returns c("Freitag", "Samstag", "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag"), meaning weekday names are in my system's locale (German).
As a result, the filtering condition:
dt <- dt[!weekdays(dt) %in% c("Saturday", "Sunday")]
does not work because "Saturday" and "Sunday" do not match "Samstag" and "Sonntag".
Issue in R/generate_output_dates.R
else if(freq %in% c("B")){
dt <- seq(from = start_date, by = "day", length.out = h+1+ceiling(h/5)*2+2) # ceiling(h/5)*2+2 ~ number of weeks*2 days (Saturday and Sunday) plus an extra weekend to be on the safe side
dt <- dt[!weekdays(dt) %in% c("Saturday", "Sunday")]
dt <- format(dt, "%Y-%m-%d")
}
Possible Fix:
Using lubridate::wday(dt) could possibly resolve this issue:
dt <- dt[lubridate::wday(dt) %in% 2:6]
In my setup, weekdays(Sys.Date() + 0:6) returns c("Freitag", "Samstag", "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag"), meaning weekday names are in my system's locale (German).
As a result, the filtering condition:
does not work because "Saturday" and "Sunday" do not match "Samstag" and "Sonntag".
Issue in R/generate_output_dates.R
Possible Fix:
Using lubridate::wday(dt) could possibly resolve this issue: