Skip to content

Instantly share code, notes, and snippets.

@latentflip
Created February 11, 2013 12:11
Show Gist options
  • Save latentflip/4754111 to your computer and use it in GitHub Desktop.
Save latentflip/4754111 to your computer and use it in GitHub Desktop.
require 'date'
old_date = Date.new(2013,1,1)
new_date = Date.new(2013,2,1)
future_date = Date.new(2013,3,1)
a_month_ago = (Date.today << 1)
puts old_date <= a_month_ago #=> true
puts new_date <= a_month_ago #=> false
puts future_date <= a_month_ago #=> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment