Module: Api::Vendor::V1::GoogleReserve::Concerns::Helpers

Extended by:
ActiveSupport::Concern
Included in:
AvailabilitiesController, BookingsController, TimeConversionsController
Defined in:
app/controllers/api/vendor/v1/google_reserve/concerns/helpers.rb

Overview

typed: ignore frozen_string_literal: true

Instance Method Summary collapse

Instance Method Details

#convert_to_utc_timestamp(date, start_time, restaurant_timezone) ⇒ Object



11
12
13
# File 'app/controllers/api/vendor/v1/google_reserve/concerns/helpers.rb', line 11

def convert_to_utc_timestamp(date, start_time, restaurant_timezone)
  Time.use_zone(restaurant_timezone || 'Asia/Bangkok') { Time.zone.parse("#{date} #{start_time}").utc.to_i }
end

#epoch_to_time(epoch, restaurant_timezone) ⇒ Object



7
8
9
# File 'app/controllers/api/vendor/v1/google_reserve/concerns/helpers.rb', line 7

def epoch_to_time(epoch, restaurant_timezone)
  Time.at(epoch.to_i).utc.in_time_zone(restaurant_timezone || 'Asia/Bangkok')
end