У меня есть приложение rails, которое подключается к базе данных SQL Server, и есть приложение для рабочего стола Windows, которое подключается к одной и той же БД. Приложение Windows использует базу данных часовых поясов Microsoft Windows, поэтому я получаю имя часового пояса, например Pacific Daylight Time
. В rails класс ActiveSupport::TimeZone
дает нам хеш отображения, где ключ будет как Pacific Time (US & Canada)
, и значение будет как America/Los_Angeles
. Есть ли что-то уже там, которое преобразует формат окна в формат стандартов, поэтому я могу использовать Time.zone
?
Или, может быть, есть драгоценный камень часового пояса, который позволит мне настроить рельсы на использование формата Windows?
Здесь массив, который я начал помогать с преобразованием, но там немного я не уверен на 100%.
DAYLIGHT = [
{name: 'Dateline Daylight Time', offset: -12, alt: 'International Date Line West'},
{name: 'UTC-11', offset: -11, alt: ''},
{name: 'Hawaiian Daylight Time', offset: -10, alt: 'Hawaii'},
{name: 'Alaskan Daylight Time', offset: -9, alt: 'Alaska'},
{name: 'Pacific Daylight Time (Mexico)', offset: -8, alt: ''},
{name: 'Pacific Daylight Time', offset: -8, alt: 'Pacific Time (US & Canada)'},
{name: 'US Mountain Daylight Time', offset: -7, alt: 'Mountain Time (US & Canada)'},
{name: 'Mountain Daylight Time (Mexico)', offset: -7, alt: ''},
{name: 'Mountain Daylight Time', offset: -7, alt: 'Mountain Time (US & Canada)'},
{name: 'Central America Daylight Time', offset: -6, alt: 'Central Time (US & Canada)'},
{name: 'Central Daylight Time', offset: -6, alt: 'Central Time (US & Canada)'},
{name: 'Central Daylight Time (Mexico)', offset: -6, alt: ''},
{name: 'Canada Central Daylight Time', offset: -6, alt: ''},
{name: 'SA Pacific Daylight Time', offset: -5, alt: ''},
{name: 'Eastern Daylight Time', offset: -5, alt: 'Eastern Time (US & Canada)'},
{name: 'US Eastern Daylight Time', offset: -5, alt: 'Eastern Time (US & Canada)'},
{name: 'Venezuela Daylight Time', offset: -4.5, alt: ''},
{name: 'Paraguay Daylight Time', offset: -4, alt: ''},
{name: 'Atlantic Daylight Time', offset: -4, alt: ''},
{name: 'Central Brazilian Daylight Time', offset: -4, alt: ''},
{name: 'SA Western Daylight Time', offset: -4, alt: ''},
{name: 'Pacific SA Daylight Time', offset: -4, alt: ''},
{name: 'Newfoundland Daylight Time', offset: -3.5, alt: ''},
{name: 'E. South America Daylight Time', offset: -3, alt: ''},
{name: 'Argentina Daylight Time', offset: -3, alt: ''},
{name: 'SA Eastern Daylight Time', offset: -3, alt: ''},
{name: 'Greenland Daylight Time', offset: -3, alt: ''},
{name: 'Montevideo Daylight Time', offset: -3, alt: ''},
{name: 'Bahia Daylight Time', offset: -3, alt: ''},
{name: 'UTC-02', offset: -2, alt: ''},
{name: 'Mid-Atlantic Daylight Time', offset: -2, alt: ''},
{name: 'Azores Daylight Time', offset: -1, alt: ''},
{name: 'Cabo Verde Daylight Time', offset: -1, alt: ''},
{name: 'Morocco Daylight Time', offset: 0, alt: ''},
{name: 'Coordinated Universal Time', offset: 0, alt: ''},
{name: 'GMT Daylight Time', offset: 0, alt: ''},
{name: 'Greenwich Daylight Time', offset: 0, alt: ''},
{name: 'W. Europe Daylight Time', offset: 1, alt: ''},
{name: 'Central Europe Daylight Time', offset: 1, alt: ''},
{name: 'Romance Daylight Time', offset: 1, alt: ''},
{name: 'Central European Daylight Time', offset: 1, alt: ''},
{name: 'W. Central Africa Daylight Time', offset: 1, alt: ''},
{name: 'Namibia Daylight Time', offset: 1, alt: ''},
{name: 'Jordan Daylight Time', offset: 2, alt: ''},
{name: 'GTB Daylight Time', offset: 2, alt: ''},
{name: 'Middle East Daylight Time', offset: 2, alt: ''},
{name: 'Egypt Daylight Time', offset: 2, alt: ''},
{name: 'Syria Daylight Time', offset: 2, alt: ''},
{name: 'E. Europe Daylight Time', offset: 2, alt: ''},
{name: 'South Africa Daylight Time', offset: 2, alt: ''},
{name: 'FLE Daylight Time', offset: 2, alt: ''},
{name: 'Turkey Daylight Time', offset: 2, alt: ''},
{name: 'Jerusalem Daylight Time', offset: 2, alt: ''},
{name: 'Russia TZ 1 Daylight Time', offset: 2, alt: ''},
{name: 'Libya Daylight Time', offset: 2, alt: ''},
{name: 'Arabic Daylight Time', offset: 3, alt: ''},
{name: 'Arab Daylight Time', offset: 3, alt: ''},
{name: 'Belarus Daylight Time', offset: 3, alt: ''},
{name: 'Russia TZ 2 Daylight Time', offset: 3, alt: ''},
{name: 'E. Africa Daylight Time', offset: 3, alt: ''},
{name: 'Iran Daylight Time', offset: 3.5, alt: ''},
{name: 'Arabian Daylight Time', offset: 4, alt: ''},
{name: 'Azerbaijan Daylight Time', offset: 4, alt: ''},
{name: 'Russia TZ 3 Daylight Time', offset: 4, alt: ''},
{name: 'Mauritius Daylight Time', offset: 4, alt: ''},
{name: 'Georgian Daylight Time', offset: 4, alt: ''},
{name: 'Caucasus Daylight Time', offset: 4, alt: ''},
{name: 'Afghanistan Daylight Time', offset: 4.5, alt: ''},
{name: 'West Asia Daylight Time', offset: 5, alt: ''},
{name: 'Russia TZ 4 Daylight Time', offset: 5, alt: ''},
{name: 'Pakistan Daylight Time', offset: 5, alt: ''},
{name: 'India Daylight Time', offset: 5.5, alt: ''},
{name: 'Sri Lanka Daylight Time', offset: 5.5, alt: ''},
{name: 'Nepal Daylight Time', offset: 5.75, alt: ''},
{name: 'Central Asia Daylight Time', offset: 6, alt: ''},
{name: 'Bangladesh Daylight Time', offset: 6, alt: ''},
{name: 'Russia TZ 5 Daylight Time', offset: 6, alt: ''},
{name: 'Myanmar Daylight Time', offset: 6.5, alt: ''},
{name: 'SE Asia Daylight Time', offset: 7, alt: ''},
{name: 'Russia TZ 6 Daylight Time', offset: 7, alt: ''},
{name: 'China Daylight Time', offset: 8, alt: ''},
{name: 'Russia TZ 7 Daylight Time', offset: 8, alt: ''},
{name: 'Malay Peninsula Daylight Time', offset: 8, alt: ''},
{name: 'W. Australia Daylight Time', offset: 8, alt: ''},
{name: 'Taipei Daylight Time', offset: 8, alt: ''},
{name: 'Ulaanbaatar Daylight Time', offset: 8, alt: ''},
{name: 'Tokyo Daylight Time', offset: 9, alt: ''},
{name: 'Korea Daylight Time', offset: 9, alt: ''},
{name: 'Russia TZ 8 Daylight Time', offset: 9, alt: ''},
{name: 'Cen. Australia Daylight Time', offset: 9.5, alt: ''},
{name: 'AUS Central Daylight Time', offset: 9.5, alt: ''},
{name: 'E. Australia Daylight Time', offset: 10, alt: ''},
{name: 'AUS Eastern Daylight Time', offset: 10, alt: ''},
{name: 'West Pacific Daylight Time', offset: 10, alt: ''},
{name: 'Tasmania Daylight Time', offset: 10, alt: ''},
{name: 'Magadan Daylight Time', offset: 10, alt: ''},
{name: 'Russia TZ 9 Daylight Time', offset: 10, alt: ''},
{name: 'Russia TZ 10 Daylight Time', offset: 11, alt: ''},
{name: 'Central Pacific Daylight Time', offset: 11, alt: ''},
{name: 'Russia TZ 11 Daylight Time', offset: 12, alt: ''},
{name: 'New Zealand Daylight Time', offset: 12, alt: ''},
{name: 'UTC+12', offset: 12, alt: ''},
{name: 'Fiji Daylight Time', offset: 12, alt: ''},
{name: 'Kamchatka Daylight Time', offset: 12, alt: ''},
{name: 'Tonga Daylight Time', offset: 13, alt: ''},
{name: 'Samoa Daylight Time', offset: 13, alt: ''},
{name: 'Line Islands Daylight Time', offset: 14, alt: ''}
]