Skip to content

Instantly share code, notes, and snippets.

@makshark
Created October 20, 2015 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makshark/e55cffbb4e58ee17e30d to your computer and use it in GitHub Desktop.
Save makshark/e55cffbb4e58ee17e30d to your computer and use it in GitHub Desktop.
def self.set_range(date = 26)
range = Range.new
if Date.today.strftime('%d') < date
start_date = Date.new((Date.today - 1.month).strftime('%Y').to_i,(Date.today - 1.month).strftime('%m').to_i, 26)
end_date = Date.new((Date.today).strftime('%Y').to_i,(Date.today).strftime('%m').to_i, 26)
range = start_date..end_date
else
end
range
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment