RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 

How do you check whether a date is in a date range?

We all know (start_date..end_date).include?(this_date) is quite slow. If you have seen Ben Orenstein's talk about refactoring, you might know (...).cover? is much faster... but is it fast enough?

No. Use Date#between? instead.

Comments

Post a Comment

Comment abilities for non registered users are currently deactivated, pending time to add a proper CAPTCHA to solve the escalating spam problem. Sorry!