A natural language date and time parser
While Temporal will eventually become a fully fledged "natural language date and time parser", it is for now purely a mathematical device for dealing with times and dates. As the project grows so more features will be added. The base mathematics are stable however and used in several production environments worldwide including one banking & financials system.
Similar Projects: Remarkably, Fixed Width Structures, Adsense Info
gem install temporal
A simple example
require 'temporal' time = Time.now puts time # => 2011-01-26 10:25:51 +0200 puts time + 1.year + 3.months - 12.weeks + 1.day # => 2012-02-03 10:25:51 +0200
Human Expectancy vs "just add x days"
Temporal focuses on what I like to call human expectance accuracy. For example, most other Ruby libraries for time delta handling would not give a result like this:
require 'temporal' time = Time.local( 2011, 01, 31 ) puts time # => 2011-01-31 00:00:00 +0200 puts time + 1.month # => 2011-02-28 00:00:00 +0200
When I'm working with time and dates and I have a date within January and someone tells me "one month later" ... the last thing I expect is for the result to be in March!