Module: StimulusPlumbers::Helpers::CalendarHelper

Included in:
StimulusPlumbers::Helpers
Defined in:
lib/stimulus_plumbers/helpers/calendar_helper.rb

Instance Method Summary collapse

Instance Method Details

#sp_calendar_month(**kwargs, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/stimulus_plumbers/helpers/calendar_helper.rb', line 6

def sp_calendar_month(**kwargs, &block)
  date = kwargs.delete(:date)
  html_options = if date
                   kwargs.deep_merge(
                     data: {
                       "calendar-month-year-value":  date.year,
                       "calendar-month-month-value": date.month - 1,
                       "calendar-month-day-value":   date.day
                     }
                   )
                 else
                   kwargs
                 end
  calendar_renderer.month(**html_options, &block)
end