Last active
March 8, 2018 11:40
-
-
Save pedrocarmona/f41d25e631c1144045971c319f1c9e17 to your computer and use it in GitHub Desktop.
Time Zone Enum Type graphql-ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Types::TimeZoneEnumType = GraphQL::EnumType.define do | |
name "TimeZoneEnum" | |
ActiveSupport::TimeZone.all.uniq! {|tz| tz.tzinfo.identifier }.map { |tz| | |
symbol = tz.tzinfo.identifier.gsub(/[^_a-zA-Z0-9]/, '_').squeeze('_').upcase! | |
value("TZ_#{symbol}", tz.tzinfo.identifier, value: tz.name) | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Query to check the values:
Result: