On iPadOS 13, when the user sets "24-hour time" to FALSE, the following code would produce the following output:
Code:
+ (NSString *)dateStringFromDate:(NSDate *)date {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"];
return [dateFormatter stringFromDate:date];
}
Output:
2020-10-19T11:55:29Z
But, on iPadOS 14, the same code produces this output:
2020-10-19T12:38:06 p.m.Z
Note: the 24-hour time toggle was set to FALSE on both operating systems. For some reason, iPadOS 14 seems to be respecting the AM/PM setting in the NSDateFormatter, but iPadOS 13 was not.
I know that setting the locale to this will remove the AM/PM entirely:
dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
But, we are trying to understand why the problem only occurs on iPadOS 14 and not 13 when the iPad settings are exactly the same.