change utc to utc.getlocal

This commit is contained in:
phyusin
2018-02-01 15:31:48 +06:30
parent ee17ddac92
commit e9d7b9e2f5
2 changed files with 6 additions and 6 deletions

View File

@@ -41,12 +41,12 @@ class Api::CheckInProcessController < Api::ApiController
lookup_checkout_time = Lookup.collection_of("checkout_time") lookup_checkout_time = Lookup.collection_of("checkout_time")
if !lookup_checkout_time.empty? if !lookup_checkout_time.empty?
checkout_at = Time.now.utc checkout_at = Time.now.utc.getlocal
lookup_checkout_time.each do |checkout_time| lookup_checkout_time.each do |checkout_time|
arr_time = checkout_time[0].split("-") arr_time = checkout_time[0].split("-")
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p")
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p")
if start_time <= checkout_at && checkout_at <= end_time if start_time <= checkout_at && checkout_at <= end_time
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
end end

View File

@@ -2,12 +2,12 @@ class Origami::CheckInProcessController < BaseOrigamiController
def check_in_process def check_in_process
lookup_checkout_time = Lookup.collection_of("checkout_time") lookup_checkout_time = Lookup.collection_of("checkout_time")
checkout_at = Time.now.utc checkout_at = Time.now.utc.getlocal
if !lookup_checkout_time.empty? if !lookup_checkout_time.empty?
lookup_checkout_time.each do |checkout_time| lookup_checkout_time.each do |checkout_time|
arr_time = checkout_time[0].split("-") arr_time = checkout_time[0].split("-")
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p")
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p")
if start_time <= checkout_at && checkout_at <= end_time if start_time <= checkout_at && checkout_at <= end_time
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
end end