How do I parse this time zone string into it’s proper format so that I can use Time.zone = <the proper time zone string>". Currently the known format type is: Eastern Time (US & Canada), Not sure why it doesn’t want to accept an even more precise format, like “(GMT-05:00) Eastern Time (US & Canada)”.
Are there any built-in tools in Rails to handle the string I have, and munge it into the proper Time.zone format? Note, the solution should map out correctly to ALL of Rail’s Time Zones list…
Not sure where you are getting your zone string, but check this
TimeZone.to_sAll you need is
Time.zone.name # => "Eastern Time (US & Canada)"If you don’t have that then parse the string with regex
https://github.com/rails/rails/blob/5fe88b11f11bb3b30bc23c57b36be4f027d915ba/activesupport/lib/active_support/values/time_zone.rb#L337