Class: QaServer::TimeService

Inherits:
Object
  • Object
show all
Defined in:
app/services/qa_server/time_service.rb

Class Method Summary collapse

Class Method Details

.current_timeActiveSupport::TimeWithZone



7
8
9
# File 'app/services/qa_server/time_service.rb', line 7

def current_time
  Time.now.in_time_zone(QaServer.config.preferred_time_zone_name)
end

.current_time_sFloat



12
13
14
# File 'app/services/qa_server/time_service.rb', line 12

def current_time_s
  current_time.to_f
end

.pretty_date(dt) ⇒ String



24
25
26
# File 'app/services/qa_server/time_service.rb', line 24

def pretty_date(dt)
  dt.in_time_zone(QaServer.config.preferred_time_zone_name).strftime("%m/%d/%Y")
end

.pretty_query_date(dt) ⇒ String



30
31
32
# File 'app/services/qa_server/time_service.rb', line 30

def pretty_query_date(dt)
  dt.in_time_zone(QaServer.config.preferred_time_zone_name).strftime("%Y-%m-%d")
end

.pretty_time(dt) ⇒ String



18
19
20
# File 'app/services/qa_server/time_service.rb', line 18

def pretty_time(dt)
  dt.in_time_zone(QaServer.config.preferred_time_zone_name).strftime("%m/%d/%Y - %I:%M %p")
end