Sha256: 3e267645a41846d290e8d45378b23c478b2c37bbb46e4e4b937c85980f11d557

Contents?: true

Size: 413 Bytes

Versions: 8

Compression:

Stored size: 413 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_title
      ->(start_date) { content_tag :span, month_name(start_date) }
    end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
simple_calendar-1.1.10 lib/simple_calendar/month_calendar.rb
simple_calendar-1.1.9 lib/simple_calendar/month_calendar.rb
simple_calendar-1.1.8 lib/simple_calendar/month_calendar.rb
simple_calendar-1.1.7 lib/simple_calendar/month_calendar.rb
simple_calendar-1.1.6 lib/simple_calendar/month_calendar.rb
simple_calendar-1.1.5 lib/simple_calendar/month_calendar.rb
simple_calendar-1.1.4 lib/simple_calendar/month_calendar.rb
simple_calendar-1.1.3 lib/simple_calendar/month_calendar.rb