fix timezone

This commit is contained in:
Thein Lin Kyaw
2023-02-09 14:55:43 +06:30
parent c580cc731a
commit 944f7a7259
52 changed files with 238 additions and 236 deletions

View File

@@ -40,15 +40,15 @@ class Api::CheckInProcessController < Api::ApiController
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
if !lookup_checkout_time.empty?
now = Time.current
lookup_checkout_time.each do |checkout_time|
arr_time = checkout_time[0].split("-")
start_time = Time.zone.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
end_time = Time.zone.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
if start_time <= now && now <= end_time
alert_time_min = checkout_time[1].to_i
end
end
now = Time.now.utc
lookup_checkout_time.each do |checkout_time|
arr_time = checkout_time[0].split("-")
start_time = Time.zone.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
end_time = Time.zone.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
if start_time <= now && now <= end_time
alert_time_min = checkout_time[1].to_i
end
end
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min, :extra_minutes => extra_minutes }
else
render :json => { :status => true }