Skip to content

Instantly share code, notes, and snippets.

@jjb
Last active January 12, 2018 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjb/5c26e96fd95d25e47ade59ae4ff948a1 to your computer and use it in GitHub Desktop.
Save jjb/5c26e96fd95d25e47ade59ae4ff948a1 to your computer and use it in GitHub Desktop.
How to access the list of all timezones which are recognized by Rails

Time.find_zone! uses these two methods to look up strings:

  • ActiveSupport::TimeZone[time_zone]
  • TZInfo::Timezone.get(time_zone)

The lists they reference are these:

  • ActiveSupport::TimeZone.all.map(&:tzinfo).map(&:canonical_identifier) (150)
  • TZInfo::Timezone.all_identifiers (606)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment