49 CPInteger _secondsFromGMT;
65 @"America/Argentina/Buenos_Aires",
79 @"Africa/Addis_Ababa",
99 @"America/Los_Angeles",
103 @"America/Los_Angeles",
113 @"ADT" :
@"America/Halifax",
114 @"AKDT" :
@"America/Juneau",
115 @"AKST" :
@"America/Juneau",
116 @"ART" :
@"America/Argentina/Buenos_Aires",
117 @"AST" :
@"America/Halifax",
118 @"BDT" :
@"Asia/Dhaka",
119 @"BRST" :
@"America/Sao_Paulo",
120 @"BRT" :
@"America/Sao_Paulo",
121 @"BST" :
@"Europe/London",
122 @"CAT" :
@"Africa/Harare",
123 @"CDT" :
@"America/Chicago",
124 @"CEST" :
@"Europe/Paris",
125 @"CET" :
@"Europe/Paris",
126 @"CLST" :
@"America/Santiago",
127 @"CLT" :
@"America/Santiago",
128 @"COT" :
@"America/Bogota",
129 @"CST" :
@"America/Chicago",
130 @"EAT" :
@"Africa/Addis_Ababa",
131 @"EDT" :
@"America/New_York",
132 @"EEST" :
@"Europe/Istanbul",
133 @"EET" :
@"Europe/Istanbul",
134 @"EST" :
@"America/New_York",
136 @"GST" :
@"Asia/Dubai",
137 @"HKT" :
@"Asia/Hong_Kong",
138 @"HST" :
@"Pacific/Honolulu",
139 @"ICT" :
@"Asia/Bangkok",
140 @"IRST" :
@"Asia/Tehran",
141 @"IST" :
@"Asia/Calcutta",
142 @"JST" :
@"Asia/Tokyo",
143 @"KST" :
@"Asia/Seoul",
144 @"MDT" :
@"America/Denver",
145 @"MSD" :
@"Europe/Moscow",
146 @"MSK" :
@"Europe/Moscow",
147 @"MST" :
@"America/Denver",
148 @"NZDT" :
@"Pacific/Auckland",
149 @"NZST" :
@"Pacific/Auckland",
150 @"PDT" :
@"America/Los_Angeles",
151 @"PET" :
@"America/Lima",
152 @"PHT" :
@"Asia/Manila",
153 @"PKT" :
@"Asia/Karachi",
154 @"PST" :
@"America/Los_Angeles",
155 @"SGT" :
@"Asia/Singapore",
157 @"WAT" :
@"Africa/Lagos",
158 @"WEST" :
@"Europe/Lisbon",
159 @"WET" :
@"Europe/Lisbon",
160 @"WIT" :
@"Asia/Jakarta" 214 var englishLocalizedName = @{
215 @"EDT" : [@"Eastern Standard Time", @"EST", @"Eastern Daylight Time", @"EDT", @"Eastern Time", @"ET"],
216 @"GMT" : [@"GMT", @"GMT", @"GMT", @"GMT", @"GMT", @"GMT"],
217 @"AST" : [@"Atlantic Standard Time", @"AST", @"Atlantic Daylight Time", @"ADT", @"Atlantic Time", @"AT"],
218 @"IRST" : [@"Iran Standard Time", @"GMT+03:30", @"Iran Daylight Time", @"GMT+03:30", @"Iran Time", @"Iran Time"],
219 @"ICT" : [@"Indochina Time", @"GMT+07:00", @"GMT+07:00", @"GMT+07:00", @"Indochina Time", @"Thailand Time"],
220 @"PET" : [@"Peru Standard Time", @"GMT-05:00", @"Peru Summer Time", @"GMT-05:00", @"Peru Standard Time", @"Peru Time"],
221 @"KST" : [@"Korean Standard Time", @"GMT+09:00", @"Korean Daylight Time", @"GMT+09:00", @"Korean Standard Time", @"South Korea Time"],
222 @"PST" : [@"Pacific Standard Time", @"PST", @"Pacific Daylight Time", @"PDT", @"Pacific Time", @"PT"],
223 @"CDT" : [@"Central Standard Time", @"CST", @"Central Daylight Time", @"CDT", @"Central Time", @"CT"],
224 @"EEST" : [@"Eastern European Standard Time", @"GMT+02:00", @"Eastern European Summer Time", @"GMT+03:00", @"Eastern European Time", @"Turkey Time"],
225 @"NZDT" : [@"New Zealand Standard Time", @"GMT+12:00", @"New Zealand Daylight Time", @"GMT+13:00", @"New Zealand Time", @"New Zealand Time (Auckland)"],
226 @"WEST" : [@"Western European Standard Time", @"GMT", @"Western European Summer Time", @"GMT+01:00", @"Western European Time", @"Portugal Time (Lisbon)"],
227 @"EAT" : [@"East Africa Time", @"GMT+03:00", @"GMT+03:00", @"GMT+03:00", @"East Africa Time", @"Ethiopia Time"],
228 @"HKT" : [@"Hong Kong Standard Time", @"GMT+08:00", @"Hong Kong Summer Time", @"GMT+08:00", @"Hong Kong Standard Time", @"Hong Kong SAR China Time"],
229 @"IST" : [@"India Standard Time", @"GMT+05:30", @"GMT+05:30", @"GMT+05:30", @"India Standard Time", @"India Time"],
230 @"MDT" : [@"Mountain Standard Time", @"MST", @"Mountain Daylight Time", @"MDT", @"Mountain Time", @"MT"],
231 @"NZST" : [@"New Zealand Standard Time", @"GMT+12:00", @"New Zealand Daylight Time", @"GMT+13:00", @"New Zealand Time", @"New Zealand Time (Auckland)"],
232 @"WIT" : [@"Western Indonesia Time", @"GMT+07:00", @"GMT+07:00", @"GMT+07:00", @"Western Indonesia Time", @"Indonesia Time (Jakarta)"],
233 @"ADT" : [@"Atlantic Standard Time", @"AST", @"Atlantic Daylight Time", @"ADT", @"Atlantic Time", @"AT"],
234 @"BST" : [@"Greenwich Mean Time", @"GMT", @"British Summer Time", @"GMT+01:00", @"United Kingdom Time", @"United Kingdom Time"],
235 @"ART" : [@"Argentina Standard Time", @"GMT-03:00", @"Argentina Summer Time", @"GMT-03:00", @"Argentina Standard Time", @"Argentina Time (Buenos Aires)"],
236 @"CAT" : [@"Central Africa Time", @"GMT+02:00", @"GMT+02:00", @"GMT+02:00", @"Central Africa Time", @"Zimbabwe Time"],
237 @"GST" : [@"Gulf Standard Time", @"GMT+04:00", @"GMT+04:00", @"GMT+04:00", @"Gulf Standard Time", @"United Arab Emirates Time"],
238 @"PDT" : [@"Pacific Standard Time", @"PST", @"Pacific Daylight Time", @"PDT", @"Pacific Time", @"PT"],
239 @"SGT" : [@"Singapore Standard Time", @"GMT+08:00", @"GMT+08:00", @"GMT+08:00", @"Singapore Standard Time", @"Singapore Time"],
240 @"COT" : [@"Colombia Standard Time", @"GMT-05:00", @"Colombia Summer Time", @"GMT-05:00", @"Colombia Standard Time", @"Colombia Time"],
241 @"PKT" : [@"Pakistan Standard Time", @"GMT+05:00", @"Pakistan Summer Time", @"GMT+05:00", @"Pakistan Standard Time", @"Pakistan Time"],
242 @"EET" : [@"Eastern European Standard Time", @"GMT+02:00", @"Eastern European Summer Time", @"GMT+03:00", @"Eastern European Time", @"Turkey Time"],
243 @"UTC" : [@"GMT", @"GMT", @"GMT", @"GMT", @"GMT", @"GMT"],
244 @"WAT" : [@"West Africa Standard Time", @"GMT+01:00", @"West Africa Summer Time", @"GMT+01:00", @"West Africa Standard Time", @"Nigeria Time"],
245 @"EST" : [@"Eastern Standard Time", @"EST", @"Eastern Daylight Time", @"EDT", @"Eastern Time", @"ET"],
246 @"JST" : [@"Japan Standard Time", @"GMT+09:00", @"Japan Daylight Time", @"GMT+09:00", @"Japan Standard Time", @"Japan Time"],
247 @"CLST" : [@"Chile Standard Time", @"GMT-04:00", @"Chile Summer Time", @"GMT-04:00", @"Chile Time", @"Chile Time (Santiago)"],
248 @"CET" : [@"Central European Standard Time", @"GMT+01:00", @"Central European Summer Time", @"GMT+02:00", @"Central European Time", @"France Time"],
249 @"BDT" : [@"Bangladesh Standard Time", @"GMT+06:00", @"Bangladesh Summer Time", @"GMT+06:00", @"Bangladesh Standard Time", @"Bangladesh Time"],
250 @"MSK" : [@"Moscow Standard Time", @"GMT+04:00", @"Moscow Summer Time", @"GMT+04:00", @"Moscow Standard Time", @"Russia Time (Moscow)"],
251 @"AKDT" : [@"Alaska Standard Time", @"AKST", @"Alaska Daylight Time", @"AKDT", @"Alaska Time", @"AKT"],
252 @"CLT" : [@"Chile Standard Time", @"GMT-04:00", @"Chile Summer Time", @"GMT-04:00", @"Chile Time", @"Chile Time (Santiago)"],
253 @"AKST" : [@"Alaska Standard Time", @"AKST", @"Alaska Daylight Time", @"AKDT", @"Alaska Time", @"AKT"],
254 @"BRST" : [@"Brasilia Standard Time", @"GMT-03:00", @"Brasilia Summer Time", @"GMT-03:00", @"Brasilia Time", @"Brazil Time (Sao Paulo)"],
255 @"BRT" : [@"Brasilia Standard Time", @"GMT-03:00", @"Brasilia Summer Time", @"GMT-03:00", @"Brasilia Time", @"Brazil Time (Sao Paulo)"],
256 @"CEST" : [@"Central European Standard Time", @"GMT+01:00", @"Central European Summer Time", @"GMT+02:00", @"Central European Time", @"France Time"],
257 @"CST" : [@"Central Standard Time", @"CST", @"Central Daylight Time", @"CDT", @"Central Time", @"CT"],
258 @"HST" : [@"Hawaii-Aleutian Standard Time", @"HST", @"Hawaii-Aleutian Daylight Time", @"HDT", @"Hawaii-Aleutian Standard Time", @"HST"],
259 @"MSD" : [@"Moscow Standard Time", @"GMT+04:00", @"Moscow Summer Time", @"GMT+04:00", @"Moscow Standard Time", @"Russia Time (Moscow)"],
260 @"MST" : [@"Mountain Standard Time", @"MST", @"Mountain Daylight Time", @"MDT", @"Mountain Time", @"MT"],
261 @"PHT" : [@"Philippine Standard Time", @"GMT+08:00", @"Philippine Summer Time", @"GMT+08:00", @"Philippine Standard Time", @"Philippines Time"],
262 @"WET" : [@"Western European Standard Time", @"GMT", @"Western European Summer Time", @"GMT+01:00", @"Western European Time", @"Portugal Time (Lisbon)"]
266 abbreviation = String(String(date).split(
"(")[1]).split(
")")[0];
273 @"en" : englishLocalizedName,
284 #pragma mark Class constructor 291 + (id)timeZoneWithAbbreviation:(
CPString)abbreviation
327 + (id)timeZoneForSecondsFromGMT:(CPInteger)seconds
329 var minutes = seconds / 60,
330 keys = [timeDifferenceFromUTC keyEnumerator],
334 while (key = [keys nextObject])
336 var value = [timeDifferenceFromUTC valueForKey:key];
338 if (value == minutes)
353 + (id)_timeZoneFromString:(
CPString)aTimeZoneString style:(NSTimeZoneNameStyle)style locale:(
CPLocale)_locale
356 return [
self timeZoneWithAbbreviation:aTimeZoneString];
358 var dict = [localizedName valueForKey:[_locale
objectForKey:CPLocaleLanguageCode]],
359 keys = [dict keyEnumerator],
362 while (key = [keys nextObject])
364 var value = [[dict valueForKey:key] objectAtIndex:style];
366 if ([value isEqualToString:aTimeZoneString])
367 return [
self timeZoneWithAbbreviation:key];
375 + (CPArray)_namesForStyle:(NSTimeZoneNameStyle)style locale:(
CPLocale)aLocale
377 var array = [CPArray array],
378 dict = [localizedName valueForKey:[aLocale
objectForKey:CPLocaleLanguageCode]],
379 keys = [dict keyEnumerator],
382 while (key = [keys nextObject])
383 [array addObject:[[dict valueForKey:key] objectAtIndex:style]];
389 #pragma mark Class accessors 424 + (void)resetSystemTimeZone
427 abbreviation = String(String(date).split(
"(")[1]).split(
")")[0];
431 [[
CPNotification defaultCenter] postNotificationName:CPSystemTimeZoneDidChangeNotification object:systemTimeZone];
465 #pragma mark Consructors 482 if (
self = [super
init])
485 _abbreviation = abbreviation;
505 if (
self = [super
init])
512 while (key = [keys nextObject])
516 if ([value isEqualToString:_name])
536 if (
self = [
self initWithName:tzName])
546 #pragma mark Methods for CPDate 557 return String(String(date).split(
"(")[1]).split(
")")[0];
565 - (CPInteger)secondsFromGMTForDate:(
CPDate)date
570 var abbreviation = String(String(date).split(
"(")[1]).split(
")")[0];
572 return [timeDifferenceFromUTC valueForKey:abbreviation] * 60;
578 - (CPInteger)secondsFromGMT
580 return [timeDifferenceFromUTC valueForKey:_abbreviation] * 60;
585 #pragma mark Compars methods 598 #pragma mark Description 611 #pragma mark Localized methods 623 return [[[localizedName valueForKey:[locale
objectForKey:CPLocaleLanguageCode]] valueForKey:_abbreviation] objectAtIndex:style];
641 - (CPInteger)secondFromGMT
643 return _secondsFromGMT;
651 return _abbreviation;
Used to implement exception handling (creating & raising).
CPTimeZoneNameStyleShortGeneric
A representation of a single point in time.
id initWithName:data:(CPString tzName, [data] CPData data)
id timeZoneWithAbbreviation:(CPString abbreviation)
CPEnumerator keyEnumerator()
CPDictionary abbreviationDictionary()
var abbreviationDictionary
A Cappuccino wrapper for any data type.
void raise:reason:(CPString aName, [reason] CPString aReason)
var timeDifferenceFromUTC
A mutable key-value pair collection.
CPInteger secondsFromGMT()
CPTimeZoneNameStyleShortStandard
CPTimeZoneNameStyleGeneric
An immutable string (collection of characters).
CPTimeZoneNameStyleStandard
id objectForKey:(id aKey)
CPTimeZone is a class to define the behvior of time zone object (like CPDatePicker) ...
BOOL isEqualToString:(CPString aString)
A notification that can be posted to a CPNotificationCenter.
CPTimeZoneNameStyleDaylightSaving
id valueForKey:(CPString aKey)
CPSystemTimeZoneDidChangeNotification
CPTimeZoneNameStyleShortDaylightSaving
id stringWithFormat:(CPString format, [,] ...)
FrameUpdater prototype description