Re: 12 hr vs 24 hr time display
Re: 12 hr vs 24 hr time display
- Subject: Re: 12 hr vs 24 hr time display
- From: Sandor Szatmari <email@hidden>
- Date: Tue, 03 Jan 2017 12:44:24 -0500
Steve,
> On Jan 3, 2017, at 12:28, Steve Christensen <email@hidden> wrote:
>
>> On Jan 3, 2017, at 8:26 AM, Sandor Szatmari <email@hidden> wrote:
>>
>> Steve,
>>
>>> On Jan 3, 2017, at 10:17, Steve Christensen <email@hidden> wrote:
>>>
>>> In the Date & Time preference panel, I assume that you're referring to the option on the Clock tab. If so, those settings refer only to the menubar clock display.
>> I just think it's weird that there are two checkboxes. It seems odd to me that one would want a 24 hr clock in the menu bar but not anywhere else.
>
> The menubar clock settings also have options for displaying the time with or without seconds, showing AM/PM, showing the day of the week, and showing the date. These options all affect the final representation in the menubar, independent of the locale settings, but you're focusing on just one of these.
Yes, I agree.
>
> I have a little bit of experience with the menubar clock in the pre-OS X world so I happen to know that those particular options were present as early as 1992, so people have been living with the arrangement for a long time.
>
>>> If you notice in that same preference panel, on the Date & Time tab, there is a message at the bottom that says, "To set date and time formats, use the Language & Region preferences." Clicking the button takes you to that other panel, and there you will find a checkbox that lets you select 24-hour time.
>> Yes, this is method 2 I referred to. If you check the Language & Region checkbox it overrides the Date & Time checkbox, enabling 24 hr time display in the menu bar clock and disabling the Date & Time checkbox. So clearly someone at Apple sees there is at least a one direction connection between these two checkboxes.
>
> That's merely an implementation detail related to a private system feature. It's no different than if you were to put such an option in your app.
I think it was the fact that Apple made a one direction connection allowing the clock's preference to be overridden is what made this unclear for me.
>
>>> The Language & Region settings are what specify the locale that is used for formatting date and time values (among other things), which is why you see those changes reflected in the NSDateFormatter methods.
>> Yes, this discrepancy (IMHO) is what I was asking about. I don't see why the option for the clock display would be separated from this option.
>>
>> What I was asking for clarity on is the fact that there is no way to detect that the user prefers 24 hr time display if they only choose method 1, the Date & Time checkbox. Should I allow my users to set 12 hr time but override it to 24 hr time if the Language & Region checkbox is checked? This doesn't feel right. I feel like Apple left room for ambiguity in their design here.
>
> The locale settings, in the Language & Region preference panel, specifies the user's current preferences in terms of general time formatting. The clock settings specify the user's current preferences for the menubar clock. I don't see the ambiguity.
I guess Apple thought that setting the Language & Region 24 hr time setting was strong enough for them to disallow the menu bar clock from being displayed in 12 hr format when it, the Language & Region, preference is set.
I guess part of me felt like the the clock should either be totally in sync with the Language & Region setting, or totally independent. Understanding this better, I will have to just pick one implementation.
Thanks for everyone's opinions.
>
>
>>>> On Jan 2, 2017, at 10:16 PM, Sandor Szatmari <email@hidden> wrote:
>>>>
>>>> I am working on a small application where the primary function is to display the time to the user. My hope was to honor the user's preference setting. I am either missing something or honoring the user's preference is harder than expected.
>>>>
>>>> So, there are two places to set 24 hr time display.
>>>>
>>>> 1. Date & Time preference panel
>>>> 2. Language & Region preference panel
>>>>
>>>> The cocoa frameworks react differently depending on where you set this.
>>>>
>>>> If set by method 1, cocoa frameworks seem unaware of this setting and it appears this is cosmetic in that it only affects the display of the clock in the NSStatusBar.
>>>>
>>>> If set by method 2, cocoa frameworks reflect this and the Date & Time setting is disabled noting that the setting has been overridden.
>>>>
>>>> So if a user uses method 1, potentially unaware of method 2, how should one go about determining the user's intentions.
>>>>
>>>> There are deprecated methods using: (didn't try, it's deprecated)
>>>> NSUserDefaults with the key NSShortTimeDateFormatString
>>>>
>>>> There are supported methods using: (works with method 2)
>>>> NSString *format = [NSDateFormatter dateFormatFromTemplate:@"j" options:0 locale:[NSLocale currentLocale]];
>>>> BOOL is24Hour = ([format rangeOfString:@"a"].location == NSNotFound);
>>>>
>>>> Can anyone provide any clarity here?
>>>>
>>>> Sandor
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden