IOS 8 issue Europe / Moscow

This strange problem appeared with the release of ios 8. Here is an example 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 2014-11-01 00:00:00 MSK (or 2014-10-31 20:00:00 +0000 )

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

PS. Check the time zone of Asia / Muscat right now (+4, like MSK). Everything is in order, the month is 11.

+6
source share
1 answer

[timezone secondsFromGMTForDate:date] returns 14400 in iOs7 and 10800 on iOs8 for a given date. It should reflect the changes made (again) by the Russian government http://www.timeanddate.com/time/change/russia/moscow , which iOs7 is not yet aware of.

+3
source

Source: https://habr.com/ru/post/975721/


All Articles