class Pagy::Calendar

def calendar_at(time, **opts)

Return the calendar object at time
def calendar_at(time, **opts)
  conf        = Marshal.load(Marshal.dump(@conf))
  page_params = {}
  @units.inject(nil) do |object, unit|
    conf[unit][:period] = object&.send(:active_period) || @period
    conf[unit][:page]   = page_params[:"#{unit}_#{@page_param}"] \
                        = Calendar.send(:create, unit, **conf[unit]).send(:page_at, time, **opts)
    conf[unit][:params] ||= {}
    conf[unit][:params].merge!(page_params)
    Calendar.send(:create, unit, **conf[unit])
  end
end