fix timezone - time with local timezone to default timezone
This commit is contained in:
@@ -40,11 +40,11 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
|
||||
if !lookup_checkout_time.empty?
|
||||
now = Time.now.utc
|
||||
now = Time.current
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
|
||||
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
|
||||
@@ -68,18 +68,18 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
if dining_facility.is_active && dining_facility.status == "available"
|
||||
if dining_facility.current_checkin_booking.nil?
|
||||
if params[:checkin_time].present?
|
||||
checkin_at = Time.parse(params[:checkin_time])
|
||||
checkin_at = Time.zone.parse(params[:checkin_time])
|
||||
else
|
||||
checkin_at = Time.now
|
||||
checkin_at = Time.current
|
||||
end
|
||||
|
||||
checkout_at = nil
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||
today = Time.now
|
||||
today = Time.current
|
||||
if !lookup_checkout_time.empty?
|
||||
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
start_time, end_time = checkout_time[0].split("-").map{ |t| Time.parse(t.strip).strftime("%H:%M%p") }
|
||||
start_time, end_time = checkout_time[0].split("-").map{ |t| Time.zone.parse(t.strip).strftime("%H:%M%p") }
|
||||
if start_time <= today.strftime("%H:%M%p") && today.strftime("%H:%M%p") <= end_time
|
||||
checkout_at = checkin_at + (checkout_time[1]).to_i.minutes
|
||||
end
|
||||
@@ -134,7 +134,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
|
||||
def request_time
|
||||
if !params[:booking_id].nil? && !params[:time].nil?
|
||||
time = Time.parse(params[:time])
|
||||
time = Time.zone.parse(params[:time])
|
||||
booking = Booking.find(params[:booking_id])
|
||||
|
||||
checkout_at = booking.checkout_at.utc
|
||||
@@ -163,9 +163,9 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
if !params[:booking_id].nil? && !params[:checkout_time].nil?
|
||||
booking = Booking.find(params[:booking_id])
|
||||
dining_facility = DiningFacility.find(booking.dining_facility_id)
|
||||
checkout_at = Time.parse(params[:checkout_time]).utc
|
||||
checkout_at = Time.zone.parse(params[:checkout_time]).utc
|
||||
if dining_facility.check_time(checkout_at, booking, "checkout")
|
||||
checkout_time = checkout_at.getlocal
|
||||
checkout_time = checkout_at
|
||||
booking.checkout_at = checkout_time
|
||||
booking.reserved_at = checkout_time
|
||||
booking.reserved_by = current_login_employee.name
|
||||
|
||||
Reference in New Issue
Block a user