No clearly documented method of determining if 24h time is enabled
||Date Originated:||King15-Feb-2017 12:48 PM|
|Product:||iOS + SDK
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.
To find a boolean on `NSLocale`
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.
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!