class Interferon::WorkHoursHelper

Constants

DEFAULT_WORK_ARGS
DEFAULT_WORK_DAYS
DEFAULT_WORK_HOURS
DEFAULT_WORK_TIMEZONE

Public Class Methods

is_work_hour?(time, args = {}) click to toggle source
# File lib/interferon/work_hours_helper.rb, line 14
def self.is_work_hour?(time, args = {})
  args = args.merge(DEFAULT_WORK_ARGS)
  tz = TZInfo::Timezone.get args[:timezone]
  time_in_tz = time + tz.period_for_utc(time).utc_offset
  args[:days].include?(time_in_tz.wday) && args[:hours].include?(time_in_tz.hour)
end