module Concerns::Event::Dates::InstanceMethods

Public Instance Methods

date_range_long_s() click to toggle source
# File app/models/concerns/event/dates.rb, line 48
def date_range_long_s
  date.to_s :long_with_week_day
end
date_range_s(format = :short) click to toggle source
# File app/models/concerns/event/dates.rb, line 40
def date_range_s(format = :short)
  if format == :long
    date.strftime('%m/%d/%Y')
  else
    "#{date.month}/#{date.day}"
  end
end
default_date() click to toggle source
# File app/models/concerns/event/dates.rb, line 24
def default_date
  if parent.present?
    parent.date
  else
    Time.zone.today
  end
end
end_date() click to toggle source
# File app/models/concerns/event/dates.rb, line 61
def end_date
  if children.any?
    children.sort.last.date
  else
    start_date
  end
end
multiple_days?() click to toggle source
# File app/models/concerns/event/dates.rb, line 74
def multiple_days?
  end_date > start_date
end
short_date() click to toggle source

Format for schedule page primarily

# File app/models/concerns/event/dates.rb, line 33
def short_date
  return '' unless date
  prefix = ' ' if date.month < 10
  suffix = ' ' if date.day < 10
  "#{prefix}#{date.month}/#{date.day}#{suffix}"
end
start_date() click to toggle source

date

# File app/models/concerns/event/dates.rb, line 53
def start_date
  date
end
start_date=(date) click to toggle source
# File app/models/concerns/event/dates.rb, line 57
def start_date=(date)
  self.date = date
end
update_date() click to toggle source

Does nothing. Allows us to treat Events and MultiDayEvents the same.

# File app/models/concerns/event/dates.rb, line 79
def update_date
end
year() click to toggle source
# File app/models/concerns/event/dates.rb, line 69
def year
  return nil unless date
  date.year
end