Revision: 37966
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 21, 2010 13:55 by lukelat
Initial Code
# Calculate the number of weekdays between dates workdays = 0 date_has_weekend = false date = self.start_at while date.to_date < finish_at.to_date #If we have a weekend day, increase finish date if date.to_date.wday == 6 or date.to_date.wday == 0 date_has_weekend = true finish_at = finish_at.to_time.advance(:days => 1) end workdays = workdays + 1 unless date.to_date.wday == 0 or date.to_date.wday == 6 date = date.to_time.advance(:days => 1) end
Initial URL
Initial Description
Initial Title
Calculate workdays in a date range
Initial Tags
date
Initial Language
Ruby