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:
Why not Chronic or Tickle¶ ↑
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 Ruby 2.0+.
git clone git://github.com/xaviershay/kronic.git bundle install # May take a while, needs to install therubyracer/V8 to test JS bin/test # Run the tests # Dive into the code at spec/kronic_spec.rb
Patches welcome! Fork and send a pull request. Please follow coding conventions already in use. If
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.