class Playbook::PbDateRangeInline::DateRangeInline

def classname

def classname
  generate_classname("pb_date_range_inline_kit", dark_class, align)
end

def dark_class

def dark_class
  dark ? "dark" : nil
end

def dates_in_current_year?

def dates_in_current_year?
  current_year = Time.current.year
  start_date.year == current_year && end_date.year == current_year
end

def end_date_display

def end_date_display
  time_display(Playbook::PbKit::PbDateTime.new(end_date))
end

def icon_color

def icon_color
  size == "sm" ? "light" : nil
end

def start_date_display

def start_date_display
  time_display(Playbook::PbKit::PbDateTime.new(start_date))
end

def text_kit

def text_kit
  case size
  when "xs"
    "caption"
  when "sm"
    "body"
  end
end

def time_display(time)

def time_display(time)
  content_tag(:time, datetime: time.to_iso) do
    if dates_in_current_year?
      "#{time.to_month_downcase} #{time.to_day}"
    else
      "#{time.to_month_downcase} #{time.to_day}, #{time.to_year}"
    end
  end
end