Methods
Public Instance methods
days_in_month()

Returns the number of days in the date’s month.

  Date.new(2004,2).days_in_month #=> 28
# File lib/facets/core/date/days_in_month.rb, line 12
  def days_in_month
     Date.civil(year, month, -1).day
  end
days_of_month()
# File lib/facets/core/date/days_of_month.rb, line 5
  def days_of_month
    (1..days_in_month).to_a
  end
stamp(format = nil)

An enhanched to_s method that cane take an optional format flag of :short or :long.

# File lib/facets/core/date/stamp.rb, line 8
  def stamp(format = nil)
    case format
    when :short
      strftime("%e %b").strip
    when :long
      strftime("%B %e, %Y").strip
    else
      strftime("%Y-%m-%d")  # standard to_s
    end
  end
to_date()

To be able to keep Dates and Times interchangeable on conversions.

# File lib/facets/core/date/to_date.rb, line 7
  def to_date
    self
  end
to_time(form = :local)

Convert Date to Time.

# File lib/facets/core/date/to_time.rb, line 7
  def to_time(form = :local)
    ::Time.send(form, year, month, day)
  end