Handle invalid time for Rails 3