Skip to content

Commit

Permalink
Date and time helper added
Browse files Browse the repository at this point in the history
  • Loading branch information
zachinglis committed Nov 8, 2008
1 parent cf21a33 commit 789011a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions date_and_time_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class DateAndTimeHelper
# Usage: in_the_future?(3.days.from_now) #=> true
def in_the_future?(to_time)
Time.now.to_date < to_time
end


# Usage: in_the_past?(3.days.ago) #=> true
def in_the_past?(from_time)
Time.now.to_date > to_time
end
end

0 comments on commit 789011a

Please sign in to comment.