class Meeting < ActiveRecord::Base
  validates_presence_of :date

  scope :past, -> { where('date < ?', Date.today) }
  scope :upcoming, -> { where('date >= ?', Date.today) }

  def display_date
    datetime = date.to_datetime
    weekday = DateTime::DAYNAMES[datetime.cwday]
    month = DateTime::MONTHNAMES[datetime.month]
    day = datetime.day
    year = datetime.year

    "#{weekday}, #{month} #{day}, #{year}"
  end

  def time
    datetime = date.to_datetime
    datetime.strftime('%l:%M %P').lstrip
  end
end

class Meeting < ActiveRecord::Base
  validates_presence_of :date

  scope :past, -> { where('date < ?', Date.today) }
  scope :upcoming, -> { where('date >= ?', Date.today) }

  def display_date
    datetime = date.to_datetime
    weekday = DateTime::DAYNAMES[datetime.cwday == 7 ? 0 : datetime.cwday]
    month = DateTime::MONTHNAMES[datetime.month]
    day = datetime.day
    year = datetime.year

    "#{weekday}, #{month} #{day}, #{year}"
  end

  def time
    datetime = date.to_datetime
    datetime.strftime('%l:%M %P').lstrip
  end
end

Change display_date method to account for the fact that the day might be Sunday
Change display_date method to account for the fact that the day might be Sunday
