module ChartJS::Helpers::Dates

Constants

MONDAY_TO_SUNDAY
WORK_DAYS

Public Instance Methods

days_of_the_week(abrv: false) { |day| ... } click to toggle source
# File lib/chart_js/chart/helpers/dates.rb, line 11
def days_of_the_week(abrv: false)
  days = if abrv
           Date::DAYNAMES
         else
           Date::ABBR_DAYNAMES
         end
  return days unless block_given?
  days.each do |day|
    yield day
  end
end
monday_to_friday()
Alias for: work_days
monday_to_sunday() { |day| ... } click to toggle source
# File lib/chart_js/chart/helpers/dates.rb, line 32
def monday_to_sunday
  return MONDAY_TO_SUNDAY unless block_given?
  MONDAY_TO_SUNDAY.each do |day|
    yield day
  end
end
months_of_the_year(abrv: false) { |month| ... } click to toggle source
# File lib/chart_js/chart/helpers/dates.rb, line 39
def months_of_the_year(abrv: false)
  months = if abrv
             Date::MONTHNAMES.reject(&:nil?)
           else
             Date::ABBR_MONTHNAMES.reject(&:nil?)
           end
  return months unless block_given?
  months.each do |month|
    yield month
  end
end
work_days() { |day| ... } click to toggle source
# File lib/chart_js/chart/helpers/dates.rb, line 23
def work_days
  return WORK_DAYS unless block_given?
  WORK_DAYS.each do |day|
    yield day
  end 
end
Also aliased as: monday_to_friday