Parse natural language dates and times into Time or Chronic::Span objects.
Examples:
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
VERSION | = | "0.9.0" |
debug | [RW] | Returns true when debug mode is enabled. |
time_class | [RW] |
Examples:
require 'chronic' require 'active_support/time' Time.zone = 'UTC' Chronic.time_class = Time.zone Chronic.parse('June 15 2006 at 5:54 AM') # => Thu, 15 Jun 2006 05:45:00 UTC +00:00 Returns The Time class Chronic uses internally. |
Construct a new time object determining possible month overflows and leap years.
year - Integer year. month - Integer month. day - Integer day. hour - Integer hour. minute - Integer minute. second - Integer second.
Returns a new Time object constructed from these params.
Parses a string containing a natural language date or time.
If the parser can find a date or time, either a Time or Chronic::Span will be returned (depending on the value of `:guess`). If no date or time can be found, `nil` will be returned.
text - The String text to parse. opts - An optional Hash of configuration options passed to Parser::new.