Skip to content

Instantly share code, notes, and snippets.

@levinalex
Created November 22, 2008 14:22
Show Gist options
  • Save levinalex/27835 to your computer and use it in GitHub Desktop.
Save levinalex/27835 to your computer and use it in GitHub Desktop.
class Date
def minus_with_date(other)
if other.class == Date
(self.minus_without_date(other)).days
else
minus_without_date(other)
end
end
alias_method :minus_without_date, :-
alias_method :-, :minus_with_date
end
Date.tomorrow - Date.today # => 1.day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment