Ruby on Rails: the best way to compare two dates?
Ruby on-RailsDateRuby on-Rails Problem Overview
I have a date variable, stored as a String in the 'YYYY-mm-dd' format. What is the best way to check, if that date has not already passed?
Ruby on-Rails Solutions
Solution 1 - Ruby on-Rails
Date.parse('2010-11-01') < Date.today
will return true if '2010-11-01' has already passed
Solution 2 - Ruby on-Rails
You can also use past?
Date.parse("2012-11-01").past?