Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8 Europe/Moscow Time Zone Issue

This strange issue appeared with ios 8 release. Here is sample code:

NSDate * date = [NSDate dateWithTimeIntervalSince1970:1414785600];

dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"ru_RU"]];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"Europe/Moscow"]];
[dateFormatter setDateStyle:NSDateFormatterFullStyle];

[dateFormatter setDateFormat:@"MM"];
NSString * month = [dateFormatter stringFromDate: date];

Date is 2014-11-01 00:00:00 MSK (or 2014-10-31 20:00:00 +0000)

Running ios 7, month value is 11. But on ios 8 it is 10. Any ideas what's wrong? Thanks.

PS. Checking Asia/Muscat timezone right now (+4 like MSK). Everything is OK, month is 11.

like image 232
user3710927 Avatar asked Sep 23 '14 14:09

user3710927


1 Answers

[timezone secondsFromGMTForDate:date] returns 14400 at iOs7 and 10800 at iOs8 for the given date. It should reflect the changes done (again) by the russian government http://www.timeanddate.com/time/change/russia/moscow which iOs7 isn't aware of yet.

like image 77
A-Live Avatar answered Oct 22 '22 09:10

A-Live