gem install kronic require 'kronic' Kronic.parse("Today") # => Date.today Kronic.format(Date.today) # => "Today"
Supported formats: Today, yesterday, tomorrow, last thursday, this thursday, 14 Sep, 14 June 2010. Any dates without a year are assumed to be in the past (that's what my app needs, so that's what it does).
Install by grabbing the latest versions direct from github:
Use with the following script:
Chronic and Tickle both parse a heap of formats. That's not useful to me when they fail on cases I want (14 Sep), and also not useful because I don't need times or spans. I just want to replace my calendar picker.
In addition, Kronic can take a date and give you a human readable form, neither of which Chronic nor Tickle does.
Kronic does not require ActiveSupport, but if it is present Kronic will use the current time zone. In short, everything should work as you would expect.
Kronic is tested on 1.8.7, 1.9.2, Rubinius 1.1, and JRuby 1.5.1.
git clone git://github.com/xaviershay/kronic.git bundle install # May take a while, needs to install therubyracer/V8 to test JS rake # Run the specs # Dive into the code at spec/kronic_spec.rb
Current release is stable, and being used in production sites. Some I18n work is in yolk's fork, but it is lagging behind the current release. I am not using this personally. Maybe also a flag to toggle the interpretation of dates without years would be nice, but not something I need.