Skip to content

Instantly share code, notes, and snippets.

@knaveofdiamonds
Created July 29, 2011 09:00
Show Gist options
  • Save knaveofdiamonds/1113475 to your computer and use it in GitHub Desktop.
Save knaveofdiamonds/1113475 to your computer and use it in GitHub Desktop.
def next_working_day(count = 1)
negative = count < 0
count = count.abs
date = negative ? yesterday : tomorrow
loop do
count -= 1 if date.working_day?
return date if count.zero?
date += (negative ? -1 : 1).day
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment