Module Chronic
In: lib/chronic.rb
lib/chronic/grabber.rb
lib/chronic/handler.rb
lib/chronic/handlers.rb
lib/chronic/mini_date.rb
lib/chronic/numerizer.rb
lib/chronic/ordinal.rb
lib/chronic/parser.rb
lib/chronic/pointer.rb
lib/chronic/repeater.rb
lib/chronic/repeaters/repeater_day.rb
lib/chronic/repeaters/repeater_day_name.rb
lib/chronic/repeaters/repeater_day_portion.rb
lib/chronic/repeaters/repeater_fortnight.rb
lib/chronic/repeaters/repeater_hour.rb
lib/chronic/repeaters/repeater_minute.rb
lib/chronic/repeaters/repeater_month.rb
lib/chronic/repeaters/repeater_month_name.rb
lib/chronic/repeaters/repeater_season.rb
lib/chronic/repeaters/repeater_season_name.rb
lib/chronic/repeaters/repeater_second.rb
lib/chronic/repeaters/repeater_time.rb
lib/chronic/repeaters/repeater_week.rb
lib/chronic/repeaters/repeater_weekday.rb
lib/chronic/repeaters/repeater_weekend.rb
lib/chronic/repeaters/repeater_year.rb
lib/chronic/scalar.rb
lib/chronic/season.rb
lib/chronic/separator.rb
lib/chronic/span.rb
lib/chronic/tag.rb
lib/chronic/time_zone.rb
lib/chronic/token.rb

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

Methods

construct   parse  

Classes and Modules

Module Chronic::Handlers
Class Chronic::Grabber
Class Chronic::Handler
Class Chronic::MiniDate
Class Chronic::Numerizer
Class Chronic::Ordinal
Class Chronic::Parser
Class Chronic::Pointer
Class Chronic::Repeater
Class Chronic::Scalar
Class Chronic::Season
Class Chronic::Separator
Class Chronic::Span
Class Chronic::Tag
Class Chronic::TimeZone
Class Chronic::Token

Constants

VERSION = "0.9.0"

Attributes

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.

Public Class methods

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.

[Validate]