app/helpers/user_helper.rb
# ----------------------------------------------------------
# For a given user and an input time in UTC, returns a time
# converted to user's preferred timezone (if it exists) 
For a given user and an input time in UTC, returns a time
converted to user's preferred timezone (if it exists)
For a given user and an input time in UTC returns a time converted to user ' s preferred timezone ( if it exists )
def user_time(user, utc_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)
    user_time = user_time_zone.utc_to_local(utc_time)
  end
def user_time ( user , utc_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 ) user_time = user_time_zone . utc_to_local ( utc_time ) end
For a given user and an input time in UTC, returns a time
converted to user's preferred timezone (if it exists)
For a given user and an input time in UTC returns a time converted to user ' s preferred timezone ( if it exists )
# Timezone in which datetime string is returned is either the # user's timezone or the East Coast time #return user_time.to_s.split(" ")[0] + " " + user_time.to_s.split(" ")[1]
user
utc_time