Date-casually is a project mainly written in Ruby, based on the MIT license.
Easy on the eyes alternative to the Rails distance_of_time_in_words_to_now helper method.
= DateCasually
If you've always expected the Rails date helpers to say "Today", "Yesterday" or "10 days ago" when asked about a specific date, then it's time to date casually.
I've never liked (and always seem to forget) the name of the Rails distance_of_time_in_words_to_now helper method. Additionally it doesn't handle obvious translations such as "today", "tomorrow" or "yesterday" and doesn't determine if a date is in the future ("10 days from now") or the past ("10 days ago").
== Quick Examples
Date.today.casual
(Date.today + 1).casual
(Date.today - 1).casual
== The :as option
If you'd like to change what increments of time DateCasually returns you can use the :as option.
(Date.today + 12).casual(:as => :days)
You can also pass in multiple options:
(Date.today + 1).casual(:as => [ :months, :years ])
The default :as options for DatCasually are:
(Date.today + 1).casual(:as => [:days, :weeks, :months, :years])
If you'd change DateCasually globally, do this:
DateCasually::Config.as = :months, :years
== i18n
DateCasually hooks into the i18n gem, but currently only supports English.
== Dependencies