module NexusCore::ReportUtils::PeriodDefinition

Public Instance Methods

full_weeks_in_period(start, till) click to toggle source
# File lib/nexus_core/report_utils.rb, line 35
def full_weeks_in_period(start, till)
  start = Date.today.last_week.beginning_of_week if start.blank?
  till = Date.today.last_week.end_of_week if till.blank?
  start = [Date.today.last_week.beginning_of_week, start.beginning_of_week].min
  till = [Date.today.last_week.end_of_week, till.end_of_week].min
  [start, till].sort {|a,b| a <=> b}
end
last_month_period() click to toggle source
# File lib/nexus_core/report_utils.rb, line 31
def last_month_period
  full_weeks_in_period(Date.today.last_month, Date.today)
end
last_week_period() click to toggle source
# File lib/nexus_core/report_utils.rb, line 27
def last_week_period
  full_weeks_in_period(Date.today.last_week, Date.today)
end