I needed to find the dates for a plus-minus
n weekdays interval, you know, when they say the product will be delivered in 5 working/week days. I couldn’t find anything, so I made this:
function weekdaysinterval(today, weekdays) function step(x, by) counter = 0 while counter < weekdays x += by if Dates.dayofweek(x) < 6 counter += 1 end end x end from = step(today, -Dates.Day(1)) to = step(today, Dates.Day(1)) from, to end
Happy to hear if this is already implemented or if you have any suggestions. Note that this implementation is for weekdays, not workingdays, and as such it assumes that a week is Monday–Friday, including (however, this is not true for some countries, e.g. Israel).