Sha256: f4b0262ec67b6b6da3acc892d78f41cdd4de07498225cbcb70b83d29456e1d6d

Contents?: true

Size: 440 Bytes

Versions: 3

Compression:

Stored size: 440 Bytes

Contents

module SimpleCalendar
  class MonthCalendar < Calendar
    def date_range
      @date_range ||= start_date.beginning_of_month.beginning_of_week..start_date.end_of_month.end_of_week
    end

    def default_header
      ->(start_date) { content_tag :span, month_name(start_date), class: "calendar-header" }
    end

    def month_name(start_date)
      "#{I18n.t("date.month_names")[start_date.month]} #{start_date.year}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_calendar-1.1.2 lib/simple_calendar/month_calendar.rb
simple_calendar-1.1.1 lib/simple_calendar/month_calendar.rb
simple_calendar-1.1.0 lib/simple_calendar/month_calendar.rb