Class: Sundial

Inherits:
Object
  • Object
show all
Defined in:
app/models/sundial.rb

Overview

Utility methods that alleviate the pain of dealign with timezones, midnight, etc…

Class Method Summary collapse

Class Method Details

.in_time_zone(organization, time_string) ⇒ Object



5
6
7
# File 'app/models/sundial.rb', line 5

def self.in_time_zone(organization, time_string)
  ActiveSupport::TimeZone.create(organization.time_zone).parse(time_string)
end

.midnightish(organization, time_string) ⇒ Object



9
10
11
# File 'app/models/sundial.rb', line 9

def self.midnightish(organization, time_string)
  in_time_zone(organization, time_string) + 1.day - 1.minute
end