module Pagy::CalendarExtra::Backend

def pagy_calendar(collection, vars = {})

Return Pagy object and items
def pagy_calendar(collection, vars = {})
  pagy = Calendar.new(pagy_calendar_get_vars(collection, vars))
  [pagy, pagy_calendar_get_items(collection, pagy)]
end

def pagy_calendar_get_items(_collection, _pagy)

for the unit by selecting the records with DateTime from pagy.from to pagy.to
This method should be implemented in the application and should return the records
def pagy_calendar_get_items(_collection, _pagy)
  # collection.your_own_method_to_get_the_items_with(pagy.from, pagy.to)
  raise NoMethodError, 'The pagy_calendar_get_items method must be implemented in the application and must return ' \
                       'the items for the unit by selecting the records with Time from pagy.from to pagy.to'
end

def pagy_calendar_get_vars(_collection, vars)

You may want to override it in order to implement the dynamic set of the :minmax variable.
Sub-method called only by #pagy_calendar: here for easy customization of variables by overriding.
def pagy_calendar_get_vars(_collection, vars)
  # vars[:minmax] ||= your_own_method_to_get_the_period_from(collection)
  vars[:page] ||= params[vars[:page_param] || DEFAULT[:page_param]]
  vars
end