Re: NSDateFormatter problems
Re: NSDateFormatter problems
- Subject: Re: NSDateFormatter problems
- From: Fritz Anderson <email@hidden>
- Date: Thu, 21 Nov 2002 14:23:09 -0600
Single-stepping through your code, I see that the default short format
on my machine is not
%m/%d/%y
but
%1m/%e/%Y
-- at least on my system, where I specified a four-digit year on short
dates in the System Preferences.
The culprit seems to be the numeral 1 in the %1m. It suppresses the
leading zero in output of month numbers.
Bug one: There is no "clean" format in the date formatter routines for
month numbers without leading zeroes, so the "precision digit"
workaround has to be used.
Bug two: NSDateFormatter apparently does not accept any string as
conforming to %1m.
I'll file this one with the Bug Reporter...
-- F
On Wednesday, November 20, 2002, at 04:47 PM, Will Cosgrove wrote:
NSString* formatString = [NSString stringWithString: [[NSUserDefaults
standardUserDefaults] objectForKey:NSShortDateFormatString]];
dateFormatter = [[NSDateFormatter alloc]
initWithDateFormat:formatString allowNaturalLanguage:NO];
//setting the table column's data cell formatter - which I know is
valid.
[[column dataCell] setFormatter: formatter];
(snip stuff)
[column setEditable: YES];
This works great to format the column's date to the localized value.
But after I set the cell's formatter I can't exit editing the cell
because the formatter ALWAYS fails when validating the date format. I
would imagine it thinks the format of the new value in the cell is
invalid, but it's not. However, if I set the formatter up with a
string like so:
dateFormatter = [[NSDateFormatter alloc]
initWithDateFormat:@"%m/%d/%y" allowNaturalLanguage:NO];
It works the way it should. Does anyone have any idea why this would
be failing, it's driving me crazy.
--
Fritz Anderson - Consulting Programmer - Chicago, IL
Mail: <email@hidden>
Risumi: <
http://resume.manoverboard.org>
_______________________________________________
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.