Browse the Ruby on Rails Community.

You are here: Browse Railsplugins Chronic Date

Chronic Date

Usage:

In a model:

Person << ActiveRecord::Base

date_attribute :birthday # add Chronic parsing to attribute
validates_date :birthday, :past=>true # add Chronic validation
validates_presence :birthday # birthday is mandatory

end

In a view:

<%= date_field :person, :birthday %>

You were born <%= friendly_date @person.birthday %> ago

NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly