I need to try to get a TZInfo a-la 'America / New_York' style string representing the local time zone of the system I'm on. I can’t figure out how to do this.
Time.zone
#<ActiveSupport::TimeZone:0x007ff2e4f89240 @name="UTC", @utc_offset=nil, @tzinfo=#<TZInfo::TimezoneProxy: Etc/UTC>, @current_period=#<TZInfo::TimezonePeriod: nil,nil,#<TZInfo::TimezoneOffsetInfo: 0,0,UTC>>>>
Here the TimezoneProxy # Etc / UTC field is the style I want, but UTC is not local time.
Time.now.zone
"EST"
Here, “EST” is not what I want, and I don’t see a way to pass Time.now or EST to TZInfo to get what I want?
Is there a way to get "America / New_York" or even a list of all equivalent timezone lines based on my current timezone?
source
share