public
Fork of mojombo/chronic
Description: Chronic is a pure Ruby natural language date parser.
Homepage: http://chronic.rubyforge.org
Clone URL: git://github.com/indirect/chronic.git
mojombo (author)
Mon Jan 28 23:13:16 -0800 2008
commit  bc84958b62840100ab06f67a6656213e81b047e9
tree    2c44b5df60c1eba0c03ab714d140210295b48360
parent  79527a32052d3234454286595118a6aa5b0f0efa
name age message
file History.txt Sat Jan 05 18:33:21 -0800 2008 fix numerizer bugs [mojombo]
file Manifest.txt Sat Jun 16 14:15:00 -0700 2007 svrc updates [mojombo]
file README.txt Mon Jan 28 23:13:16 -0800 2008 update readme with git info [mojombo]
file Rakefile Sat Mar 31 19:56:18 -0700 2007 numerizer, time overflow [mojombo]
directory benchmark/ Mon Sep 04 11:43:02 -0700 2006 added pre-existing codebase [mojombo]
file chronic.gemspec Mon Jan 15 17:35:36 -0800 2007 bug fixes, seconds for all dates, hoe [mojombo]
directory lib/ Sat Jan 05 18:33:21 -0800 2008 fix numerizer bugs [mojombo]
directory test/ Sat Jan 05 18:33:21 -0800 2008 fix numerizer bugs [mojombo]
README.txt
Chronic
  http://chronic.rubyforge.org/
  by Tom Preston-Werner

== DESCRIPTION:

Chronic is a natural language date/time parser written in pure Ruby. See below for the wide variety of formats Chronic 
will parse.

== INSTALLATION:

Chronic can be installed via RubyGems:

  $ sudo gem install chronic
  
== CODE:

You can grab the code (and help with development) via git:

  $ git clone git://github.com/mojombo/chronic.git

== USAGE:

You can parse strings containing a natural language date using the Chronic.parse method.

  require 'rubygems'
  require 'chronic'

  Time.now   #=> Sun Aug 27 23:18:25 PDT 2006

  #---

  Chronic.parse('tomorrow')       
    #=> Mon Aug 28 12:00:00 PDT 2006

  Chronic.parse('monday', :context => :past)
    #=> Mon Aug 21 12:00:00 PDT 2006

  Chronic.parse('this tuesday 5:00')
    #=> Tue Aug 29 17:00:00 PDT 2006

  Chronic.parse('this tuesday 5:00', :ambiguous_time_range => :none)
    #=> Tue Aug 29 05:00:00 PDT 2006

  Chronic.parse('may 27th', :now => Time.local(2000, 1, 1))
    #=> Sat May 27 12:00:00 PDT 2000

  Chronic.parse('may 27th', :guess => false)
    #=> Sun May 27 00:00:00 PDT 2007..Mon May 28 00:00:00 PDT 2007

See Chronic.parse for detailed usage instructions.

== EXAMPLES:

Chronic can parse a huge variety of date and time formats. Following is a small sample of strings that will be properly 
parsed. Parsing is case insensitive and will handle common abbreviations and misspellings.

Simple

  thursday
  november
  summer
  friday 13:00
  mon 2:35
  4pm
  6 in the morning
  friday 1pm
  sat 7 in the evening
  yesterday
  today
  tomorrow
  this tuesday
  next month
  last winter
  this morning
  last night
  this second
  yesterday at 4:00
  last friday at 20:00
  last week tuesday
  tomorrow at 6:45pm
  afternoon yesterday
  thursday last week

Complex

  3 years ago
  5 months before now
  7 hours ago
  7 days from now
  1 week hence
  in 3 hours
  1 year ago tomorrow
  3 months ago saturday at 5:00 pm
  7 hours before tomorrow at noon
  3rd wednesday in november
  3rd month next year
  3rd thursday this september
  4th day last week

Specific Dates

  January 5
  dec 25
  may 27th
  October 2006
  oct 06
  jan 3 2010
  february 14, 2004
  3 jan 2000
  17 april 85
  5/27/1979
  27/5/1979
  05/06
  1979-05-27
  Friday
  5
  4:00
  17:00
  0800

Specific Times (many of the above with an added time)

  January 5 at 7pm
  1979-05-27 05:00:00
  etc

== LIMITATIONS:
  
Chronic uses Ruby's built in Time class for all time storage and computation. Because of this, only times that the Time 
class can handle will be properly parsed. Parsing for times outside of this range will simply return nil. Support for a 
wider range of times is planned for a future release.

Time zones other than the local one are not currently supported. Support for other time zones is planned for a future 
release.

== LICENSE:

(The MIT License)

Copyright (c) 2006 Ryan Davis, Zen Spider Software

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.