Last active
August 19, 2023 19:40
-
-
Save Envek/cda8a367764dc2cacbc0 to your computer and use it in GitHub Desktop.
Full list of russian time zones for Ruby on Rails
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
# Full list of Russian Federation time zones with helper to get this list. | |
# Place this file in config/initializers/timezones.ru.rb | |
class ActiveSupport::TimeZone | |
@country_zones = ThreadSafe::Cache.new | |
def self.country_zones(country_code) | |
code = country_code.to_s.upcase | |
@country_zones[code] ||= | |
TZInfo::Country.get(code).zone_identifiers.select do |tz_id| | |
MAPPING.key(tz_id) | |
end.map do |tz_id| | |
self[MAPPING.key(tz_id)] | |
end | |
end | |
def self.ru_zones | |
@ru_zones ||= country_zones('RU') | |
end | |
end | |
ActiveSupport::TimeZone::MAPPING['Kaliningrad'] = 'Europe/Kaliningrad' | |
ActiveSupport::TimeZone::MAPPING['Simferopol'] = 'Europe/Simferopol' | |
ActiveSupport::TimeZone::MAPPING['Volgograd'] = 'Europe/Volgograd' | |
ActiveSupport::TimeZone::MAPPING['Samara'] = 'Europe/Samara' | |
ActiveSupport::TimeZone::MAPPING['Astrakhan'] = 'Europe/Astrakhan' | |
ActiveSupport::TimeZone::MAPPING['Ulyanovsk'] = 'Europe/Ulyanovsk' | |
ActiveSupport::TimeZone::MAPPING['Omsk'] = 'Asia/Omsk' | |
ActiveSupport::TimeZone::MAPPING['Barnaul'] = 'Asia/Barnaul' | |
ActiveSupport::TimeZone::MAPPING['Novokuznetsk'] = 'Asia/Novokuznetsk' | |
ActiveSupport::TimeZone::MAPPING['Chita'] = 'Asia/Chita' | |
ActiveSupport::TimeZone::MAPPING['Khandyga'] = 'Asia/Khandyga' | |
ActiveSupport::TimeZone::MAPPING['Sakhalin'] = 'Asia/Sakhalin' | |
ActiveSupport::TimeZone::MAPPING['Ust-Nera'] = 'Asia/Ust-Nera' | |
ActiveSupport::TimeZone::MAPPING['Srednekolymsk'] = 'Asia/Srednekolymsk' | |
ActiveSupport::TimeZone::MAPPING['Anadyr'] = 'Asia/Anadyr' |
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
# Translations for timezones added in config/initializers/timezones.ru.rb for use with i18n-timezones gem | |
# Place this file in config/locales/timezones.ru.yml | |
ru: | |
timezones: | |
Kaliningrad: Калининград | |
Simferopol: Республика Крым и Севастополь | |
Volgograd: Волгоград | |
Astrakhan: Астрахань | |
Ulyanovsk: Ульяновск | |
Samara: Самара | |
Omsk: Омск | |
Barnaul: Барнаул | |
Novokuznetsk: Новокузнецк | |
Chita: Чита | |
Khandyga: Хандыга | |
Sakhalin: Сахалин | |
Ust-Nera: Усть-Нера | |
Srednekolymsk: Среднеколымск и Северные Курилы | |
Anadyr: Анадырь |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Following are missing from this list: