Module: Date::Format

Defined in:
lib/date/format.rb

Overview

Holds some constants used by the pure ruby parsing code.

The STYLE constant (a hash) allows the user to modify the parsing of DD/DD/DD and DD.DD.DD dates. For DD/DD/DD dates, you can set the :slash entry to :mdy (month/day/year, :dmy (day/month/year), or :ymd (year/month/day). The same can be done for DD.DD.DD dates using the :dot entry. Example:

Date::Format::STYLE[:slash] = :mdy
Date::Format::STYLE[:dot] = :dmy

Constant Summary collapse

STYLE =

On Ruby 1.8.7, DD/DD/DD is interpreted by default as month, day, year, and DD.DD.DD is interpreted by default as year, month, day.

{:dot=>:ymd, :slash=>:mdy}
MONTHS =

Hash mapping lowercase month names to month numbers (e.g. MONTHS => 1)

{
  'january'  => 1, 'february' => 2, 'march'    => 3, 'april'    => 4,
  'may'      => 5, 'june'     => 6, 'july'     => 7, 'august'   => 8,
  'september'=> 9, 'october'  =>10, 'november' =>11, 'december' =>12
}
DAYS =

Hash mapping lowercase day names to day numbers (e.g. DAYS => 0)

{
  'sunday'   => 0, 'monday'   => 1, 'tuesday'  => 2, 'wednesday'=> 3,
  'thursday' => 4, 'friday'   => 5, 'saturday' => 6
}
ABBR_MONTHS =

Hash mapping abbreviated lowercase month names to month numbers (e.g. ABBR_MONTHS => 1)

{
  'jan'      => 1, 'feb'      => 2, 'mar'      => 3, 'apr'      => 4,
  'may'      => 5, 'jun'      => 6, 'jul'      => 7, 'aug'      => 8,
  'sep'      => 9, 'oct'      =>10, 'nov'      =>11, 'dec'      =>12
}
ABBR_DAYS =

Hash mapping abbreviated lowercase day names to day numbers (e.g. ABBR_DAYS => 0)

{
  'sun'      => 0, 'mon'      => 1, 'tue'      => 2, 'wed'      => 3,
  'thu'      => 4, 'fri'      => 5, 'sat'      => 6
}
ZONES =

Hash mapping lowercase time zone names to offsets in seconds (e.g. ZONES => -28800)

Date::ZONES