NSCalendarDate bug, or my fault?
NSCalendarDate bug, or my fault?
- Subject: NSCalendarDate bug, or my fault?
- From: Dan Wood <email@hidden>
- Date: Sat, 23 Mar 2002 17:11:44 -0800
I'm trying to format a time in an NSCalendarDate to include the
user's AM/PM designator if the user's preferences indicate a
12-hour clock, but without that if they use a 24-hour clock.
So first, I can get the time format string like this:
NSString *timeFormat = [defaults objectForKey:@"NSTimeFormatString"];
For US 12-hour format, this is "%1I:%M:%S". OK, but %p is the
designator for AM/PM, so I have to append that to my time format
string. I assume it will use the value in the NSAMPMDesignation
default, which for US is (" AM", " PM"). Note the spaces in
front of the AM and the PM.
So if my time format string is "%1I:%M%p", I would expect it to
come out with a space before the AM or PM. But it doesn't.
If I use a 24-hour clock, like Spanish, the NSTimeFormatString
is "%H:%M:%S" and the NSAMPMDesignation is ("", ""). So
everything should just work.
But instead, the AM/PM appears after my 24-hour time, e.g.
"17:01PM". This is bad.
So it appears that the %p formatter isn't hooked up to the
NSAMPMDesignation. I have to write code to scan the
NSTimeFormatString, and if it's 12-hour format, then append the
%p to my time formatter string.
Am I missing something here, or should I file a bug report?
Dan
--
Dan Wood
Karelia Software, LLC
email@hidden
http://www.karelia.com/
Watson for Mac OS X:
http://www.karelia.com/watson/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.