Last active
February 23, 2016 11:50
-
-
Save kdiogenes/262d4630c2a1605fe4d1 to your computer and use it in GitHub Desktop.
rails: add brazilian time zones to ActiveSupport::TimeZone
This file contains hidden or 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
| ActiveSupport::TimeZone::MAPPING['Fernando de Noronha'] = 'America/Noronha' | |
| ActiveSupport::TimeZone::MAPPING['Amazônia'] = 'America/Manaus' | |
| ActiveSupport::TimeZone::MAPPING['Acre'] = 'America/Rio_Branco' | |
| ActiveSupport::TimeZone.instance_variable_set('@zones', nil) | |
| ActiveSupport::TimeZone.instance_variable_set('@zones_map', nil) | |
| module ActiveSupport | |
| class TimeZone | |
| def self.br_zones | |
| @br_zones ||= all.find_all { |z| z.name =~ /Brasilia|Noronha|Amazônia|Acre/ } | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment