Module: Timing::Helpers

Included in:
Timing
Defined in:
lib/timing/helpers.rb

Constant Summary collapse

TIME_REGEXP =
/(\d\d:\d\d:\d\d)/
TIME_FORMAT =
'%F %T %z'

Instance Method Summary collapse

Instance Method Details

#beginning_of_day(time) ⇒ Object



7
8
9
# File 'lib/timing/helpers.rb', line 7

def beginning_of_day(time)
  TimeInZone.parse time.strftime(TIME_FORMAT).sub(TIME_REGEXP, '00:00:00')
end

#end_of_day(time) ⇒ Object



11
12
13
# File 'lib/timing/helpers.rb', line 11

def end_of_day(time)
  TimeInZone.parse time.strftime(TIME_FORMAT).sub(TIME_REGEXP, '23:59:59')
end