Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A dirt simple library for parsing human readable dates

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 HISTORY
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 kronic.gemspec
README.rdoc

Kronic

A dirt simple library for parsing human readable dates (Today, Yesterday, Last Monday).

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.

Oh yeah, Kronic is about 100 lines of code.

Usage

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.

Future

Kronic will be totally timezone aware. It may or may not be now, I haven't specced it. Maybe a flag to toggle interpretation of dates without years.

Something went wrong with that request. Please try again.