No clearly documented method of determining if 24h time is enabled

Originator:brian.king
Number:rdar://30536049 Date Originated:King15-Feb-2017 12:48 PM
Status:open Resolved:
Product:iOS + SDK Product Version:
Classification: Reproducible:
 
Area:
Foundation

Summary:
It's occasionally important to know if the user has 24 hour time enabled. For instance, a device may way to sync the users time preference to a peripheral, or a user may want to present a custom date string or UI element. The only manner to check this using NSDateFormatter:

NSString *format = [NSDateFormatter dateFormatFromTemplate:@"j" options:0 locale:[NSLocale currentLocale]];
BOOL is24Hour = ([format rangeOfString:@"a"].location == NSNotFound);

It would be nice to have something analogous to:

[[NSLocale currentLocale] uses24HourTime];

Steps to Reproduce:
Attempt to get 24 hour time.

Expected Results:
To find a boolean on `NSLocale`

Actual Results:
Search NSLocale for a solution and fail. Search Stack Overflow and find this answer: http://stackoverflow.com/questions/12214398/detect-iphone-24-hour-time-setting. Ask on Slack to see if there's a better way. Receive a general consensus that this is the best way. Be told that you should file a radar to request your enhancement.

Version:
Any iOS

Notes:


Configuration:
Any iOS

Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!