Skip to content

Instantly share code, notes, and snippets.

@timmatheson
Created November 3, 2010 19:44
Show Gist options
  • Save timmatheson/661583 to your computer and use it in GitHub Desktop.
Save timmatheson/661583 to your computer and use it in GitHub Desktop.
Takes a week number and returns a range of dates occurring during the given week.
def start_and_end_dates_from_week_number(number)
end_time = Time.now.at_beginning_of_year.utc + (number).weeks
((end_time-1.week)..end_time)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment