Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Information</key>
<dict>
<key>Description</key>
<string>Map Rails ActiveSupport timezones to iOS readable timezone IDs.</string>
<key>Version</key>
<string>1.0</string>
</dict>
<key>TimeZones</key>
<dict>
<key>International Date Line West</key>
<string>Pacific/Midway</string>
<key>Midway Island</key>
<string>Pacific/Midway</string>
<key>American Samoa</key>
<string>Pacific/Pago_Pago</string>
<key>Hawaii</key>
<string>Pacific/Honolulu</string>
<key>Alaska</key>
<string>America/Juneau</string>
<key>Pacific Time (US &amp; Canada)</key>
<string>America/Los_Angeles</string>
<key>Tijuana</key>
<string>America/Tijuana</string>
<key>Mountain Time (US &amp; Canada)</key>
<string>America/Denver</string>
<key>Arizona</key>
<string>America/Phoenix</string>
<key>Chihuahua</key>
<string>America/Chihuahua</string>
<key>Mazatlan</key>
<string>America/Mazatlan</string>
<key>Central Time (US &amp; Canada)</key>
<string>America/Chicago</string>
<key>Saskatchewan</key>
<string>America/Regina</string>
<key>Guadalajara</key>
<string>America/Mexico_City</string>
<key>Mexico City</key>
<string>America/Mexico_City</string>
<key>Monterrey</key>
<string>America/Monterrey</string>
<key>Central America</key>
<string>America/Guatemala</string>
<key>Eastern Time (US &amp; Canada)</key>
<string>America/New_York</string>
<key>Indiana (East)</key>
<string>America/Indiana/Indianapolis</string>
<key>Bogota</key>
<string>America/Bogota</string>
<key>Lima</key>
<string>America/Lima</string>
<key>Quito</key>
<string>America/Lima</string>
<key>Atlantic Time (Canada)</key>
<string>America/Halifax</string>
<key>Caracas</key>
<string>America/Caracas</string>
<key>La Paz</key>
<string>America/La_Paz</string>
<key>Santiago</key>
<string>America/Santiago</string>
<key>Newfoundland</key>
<string>America/St_Johns</string>
<key>Brasilia</key>
<string>America/Sao_Paulo</string>
<key>Buenos Aires</key>
<string>America/Argentina/Buenos_Aires</string>
<key>Georgetown</key>
<string>America/Guyana</string>
<key>Greenland</key>
<string>America/Godthab</string>
<key>Mid-Atlantic</key>
<string>Atlantic/South_Georgia</string>
<key>Azores</key>
<string>Atlantic/Azores</string>
<key>Cape Verde Is.</key>
<string>Atlantic/Cape_Verde</string>
<key>Dublin</key>
<string>Europe/Dublin</string>
<key>Edinburgh</key>
<string>Europe/London</string>
<key>Lisbon</key>
<string>Europe/Lisbon</string>
<key>London</key>
<string>Europe/London</string>
<key>Casablanca</key>
<string>Africa/Casablanca</string>
<key>Monrovia</key>
<string>Africa/Monrovia</string>
<key>UTC</key>
<string>Etc/UTC</string>
<key>Belgrade</key>
<string>Europe/Belgrade</string>
<key>Bratislava</key>
<string>Europe/Bratislava</string>
<key>Budapest</key>
<string>Europe/Budapest</string>
<key>Ljubljana</key>
<string>Europe/Ljubljana</string>
<key>Prague</key>
<string>Europe/Prague</string>
<key>Sarajevo</key>
<string>Europe/Sarajevo</string>
<key>Skopje</key>
<string>Europe/Skopje</string>
<key>Warsaw</key>
<string>Europe/Warsaw</string>
<key>Zagreb</key>
<string>Europe/Zagreb</string>
<key>Brussels</key>
<string>Europe/Brussels</string>
<key>Copenhagen</key>
<string>Europe/Copenhagen</string>
<key>Madrid</key>
<string>Europe/Madrid</string>
<key>Paris</key>
<string>Europe/Paris</string>
<key>Amsterdam</key>
<string>Europe/Amsterdam</string>
<key>Berlin</key>
<string>Europe/Berlin</string>
<key>Bern</key>
<string>Europe/Berlin</string>
<key>Rome</key>
<string>Europe/Rome</string>
<key>Stockholm</key>
<string>Europe/Stockholm</string>
<key>Vienna</key>
<string>Europe/Vienna</string>
<key>West Central Africa</key>
<string>Africa/Algiers</string>
<key>Bucharest</key>
<string>Europe/Bucharest</string>
<key>Cairo</key>
<string>Africa/Cairo</string>
<key>Helsinki</key>
<string>Europe/Helsinki</string>
<key>Kyiv</key>
<string>Europe/Kiev</string>
<key>Riga</key>
<string>Europe/Riga</string>
<key>Sofia</key>
<string>Europe/Sofia</string>
<key>Tallinn</key>
<string>Europe/Tallinn</string>
<key>Vilnius</key>
<string>Europe/Vilnius</string>
<key>Athens</key>
<string>Europe/Athens</string>
<key>Istanbul</key>
<string>Europe/Istanbul</string>
<key>Minsk</key>
<string>Europe/Minsk</string>
<key>Jerusalem</key>
<string>Asia/Jerusalem</string>
<key>Harare</key>
<string>Africa/Harare</string>
<key>Pretoria</key>
<string>Africa/Johannesburg</string>
<key>Moscow</key>
<string>Europe/Moscow</string>
<key>St. Petersburg</key>
<string>Europe/Moscow</string>
<key>Volgograd</key>
<string>Europe/Moscow</string>
<key>Kuwait</key>
<string>Asia/Kuwait</string>
<key>Riyadh</key>
<string>Asia/Riyadh</string>
<key>Nairobi</key>
<string>Africa/Nairobi</string>
<key>Baghdad</key>
<string>Asia/Baghdad</string>
<key>Tehran</key>
<string>Asia/Tehran</string>
<key>Abu Dhabi</key>
<string>Asia/Muscat</string>
<key>Muscat</key>
<string>Asia/Muscat</string>
<key>Baku</key>
<string>Asia/Baku</string>
<key>Tbilisi</key>
<string>Asia/Tbilisi</string>
<key>Yerevan</key>
<string>Asia/Yerevan</string>
<key>Kabul</key>
<string>Asia/Kabul</string>
<key>Ekaterinburg</key>
<string>Asia/Yekaterinburg</string>
<key>Islamabad</key>
<string>Asia/Karachi</string>
<key>Karachi</key>
<string>Asia/Karachi</string>
<key>Tashkent</key>
<string>Asia/Tashkent</string>
<key>Chennai</key>
<string>Asia/Kolkata</string>
<key>Kolkata</key>
<string>Asia/Kolkata</string>
<key>Mumbai</key>
<string>Asia/Kolkata</string>
<key>New Delhi</key>
<string>Asia/Kolkata</string>
<key>Kathmandu</key>
<string>Asia/Kathmandu</string>
<key>Astana</key>
<string>Asia/Dhaka</string>
<key>Dhaka</key>
<string>Asia/Dhaka</string>
<key>Sri Jayawardenepura</key>
<string>Asia/Colombo</string>
<key>Almaty</key>
<string>Asia/Almaty</string>
<key>Novosibirsk</key>
<string>Asia/Novosibirsk</string>
<key>Rangoon</key>
<string>Asia/Rangoon</string>
<key>Bangkok</key>
<string>Asia/Bangkok</string>
<key>Hanoi</key>
<string>Asia/Bangkok</string>
<key>Jakarta</key>
<string>Asia/Jakarta</string>
<key>Krasnoyarsk</key>
<string>Asia/Krasnoyarsk</string>
<key>Beijing</key>
<string>Asia/Shanghai</string>
<key>Chongqing</key>
<string>Asia/Chongqing</string>
<key>Hong Kong</key>
<string>Asia/Hong_Kong</string>
<key>Urumqi</key>
<string>Asia/Urumqi</string>
<key>Kuala Lumpur</key>
<string>Asia/Kuala_Lumpur</string>
<key>Singapore</key>
<string>Asia/Singapore</string>
<key>Taipei</key>
<string>Asia/Taipei</string>
<key>Perth</key>
<string>Australia/Perth</string>
<key>Irkutsk</key>
<string>Asia/Irkutsk</string>
<key>Ulaan Bataar</key>
<string>Asia/Ulaanbaatar</string>
<key>Seoul</key>
<string>Asia/Seoul</string>
<key>Osaka</key>
<string>Asia/Tokyo</string>
<key>Sapporo</key>
<string>Asia/Tokyo</string>
<key>Tokyo</key>
<string>Asia/Tokyo</string>
<key>Yakutsk</key>
<string>Asia/Yakutsk</string>
<key>Darwin</key>
<string>Australia/Darwin</string>
<key>Adelaide</key>
<string>Australia/Adelaide</string>
<key>Canberra</key>
<string>Australia/Melbourne</string>
<key>Melbourne</key>
<string>Australia/Melbourne</string>
<key>Sydney</key>
<string>Australia/Sydney</string>
<key>Brisbane</key>
<string>Australia/Brisbane</string>
<key>Hobart</key>
<string>Australia/Hobart</string>
<key>Vladivostok</key>
<string>Asia/Vladivostok</string>
<key>Guam</key>
<string>Pacific/Guam</string>
<key>Port Moresby</key>
<string>Pacific/Port_Moresby</string>
<key>Magadan</key>
<string>Asia/Magadan</string>
<key>Solomon Is.</key>
<string>Asia/Magadan</string>
<key>New Caledonia</key>
<string>Pacific/Noumea</string>
<key>Fiji</key>
<string>Pacific/Fiji</string>
<key>Kamchatka</key>
<string>Asia/Kamchatka</string>
<key>Marshall Is.</key>
<string>Pacific/Majuro</string>
<key>Auckland</key>
<string>Pacific/Auckland</string>
<key>Wellington</key>
<string>Pacific/Auckland</string>
<key>Nuku'alofa</key>
<string>Pacific/Tongatapu</string>
<key>Tokelau Is.</key>
<string>Pacific/Fakaofo</string>
<key>Samoa</key>
<string>Pacific/Apia</string>
</dict>
</dict>
</plist>
// Save the above plist somewhere in your project. Then use it like this:
NSString *activeRecordTimeZoneName = @"American Samoa";
NSDictionary *timeZoneMap = [[NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"ActiveRecord2iOS_Timezones" ofType:@"plist"]] objectForKey:@"TimeZones"];
return [NSTimeZone timeZoneWithName:[timeZoneMap valueForKey:activeRecordTimeZoneName]];
@semanticart

This comment has been minimized.

semanticart commented Mar 11, 2014

All of these still work except for "Ulaan Bataar" which is now "Ulaanbaatar" in rails.

@SHANMUGAM1991

This comment has been minimized.

SHANMUGAM1991 commented Sep 12, 2015

Nice Work.Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment