Skip to content

Instantly share code, notes, and snippets.

@climyao
Created January 24, 2013 21:18
Show Gist options
  • Save climyao/4627852 to your computer and use it in GitHub Desktop.
Save climyao/4627852 to your computer and use it in GitHub Desktop.
Calculate beginning and end of payroll given an arbitrary date
def beginning_of_payroll(given_date)
payroll_start_seed = Date.new(2011,12,02)
given_date - ( (given_date - payroll_start_seed).abs % 14 )
end
def end_of_payroll(given_date)
beginning_of_payroll(given_date) + 13
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment