Sha256: e91ffd6af4c6cf182cc7ff469bc8b1a9ebd34adfba6e2f3efd4e1d727b651781
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# See Pagy::Countless API documentation: https://ddnexus.github.io/pagy/api/calendar # frozen_string_literal: true class Pagy # :nodoc: class Calendar # :nodoc: # Calendar day subclass class Day < Calendar DEFAULT = { order: :asc, # rubocop:disable Style/MutableConstant format: '%Y-%m-%d' } protected # Setup the calendar variables def setup_unit_vars super @initial = @starting.beginning_of_day @final = @ending.tomorrow.beginning_of_day @pages = @last = page_offset(@initial, @final) @from = starting_time_for(@page) @to = @from.tomorrow end # Starting time for the page def starting_time_for(page) @initial.days_since(time_offset_for(page)) end def page_offset_at(time) page_offset(@initial, time.beginning_of_day) end private def page_offset(time_a, time_b) # remove in 6.0 (time_b.time - time_a.time).to_i / 1.day end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pagy-6.0.0 | lib/pagy/calendar/day.rb |