app/helpers/user_helper.rb
def user_utc_time(user, user_time)
    
    # Timezone in which datetime is returned is either the
    # user's timezone or the East Coast time
    if user.andand.time_zone && utc_time
      time_zone = user.time_zone
    else
      time_zone = TimeZone.find_by(name: "America/New_York")
    end
    user_time_zone = TZInfo::Timezone.get(time_zone.name)
    utc_time = user_time_zone.local_to_utc(user_time)
    return utc_time
  end
# ----------------------------------------------------------
# For a given user and his/her time local, returns a time
# converted to UTC 
For a given user and his/her time local, returns a time
converted to UTC
For a given user and his / her time local returns a time converted to UTC
def user_utc_time(user, user_time)
    if user.andand.time_zone && utc_time
      time_zone = user.time_zone
    else
      time_zone = TimeZone.find_by(name: "America/New_York")
    end
    user_time_zone = TZInfo::Timezone.get(time_zone.name)
    utc_time = user_time_zone.local_to_utc(user_time)
    return utc_time
  end
def user_utc_time ( user , user_time ) if user . andand . time_zone && utc_time time_zone = user . time_zone else time_zone = TimeZone . find_by ( name : "America/New_York" ) end user_time_zone = TZInfo :: Timezone . get ( time_zone . name ) utc_time = user_time_zone . local_to_utc ( user_time ) return utc_time end
For a given user and his/her time local, returns a time
converted to UTC
For a given user and his / her time local returns a time converted to UTC
# Timezone in which datetime is returned is either the # user's timezone or the East Coast time
user
user_time