Class: ContentBlockTools::TimePeriodComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/content_block_tools/time_period_component.rb

Instance Method Summary collapse

Methods inherited from BaseComponent

#render

Methods included from OverrideClasses

#font_classes, #font_size_class, #font_weight_class, #margin_classes, #padding_classes

Methods included from Govspeak

#render_govspeak

Constructor Details

#initialize(content_block:, _block_type: nil, _block_name: nil) ⇒ TimePeriodComponent

Returns a new instance of TimePeriodComponent.



3
4
5
# File 'app/components/content_block_tools/time_period_component.rb', line 3

def initialize(content_block:, _block_type: nil, _block_name: nil)
  @content_block = content_block
end

Instance Method Details

#end_dateObject



13
14
15
16
17
# File 'app/components/content_block_tools/time_period_component.rb', line 13

def end_date
  presented_date(
    content_block.details.dig(:date_range, :end, :date),
  )
end

#start_dateObject



7
8
9
10
11
# File 'app/components/content_block_tools/time_period_component.rb', line 7

def start_date
  presented_date(
    content_block.details.dig(:date_range, :start, :date),
  )
end