NSDateFormatter natural language issue
NSDateFormatter natural language issue
- Subject: NSDateFormatter natural language issue
- From: Jeremy Dronfield <email@hidden>
- Date: Mon, 12 Dec 2005 14:01:48 +0000
I'm creating a date formatter for a text field like so:
NSDateFormatter *dateFormat;
dateFormat = [[NSDateFormatter alloc] initWithDateFormat:
[[NSUserDefaults standardUserDefaults]
objectForKey:NSDateFormatString] allowNaturalLanguage:YES];
[newEntryField setFormatter:dateFormat];
[dateFormat release];
I'm in Britain, so I use the date format dd-mm-yyyy. However, when
the text "11/12/05" is typed into the field, it gets represented as
"12 November 2005" instead of "11 December 2005". So, the formatting
is correct, but the interpretation of the value entered by the user
is incorrect - i.e. it's interpreted according to the US date standard.
Is there a way around this? I see that Tiger has introduce a -
setLocale: method. I've no idea whether this would fix the problem.
Also, experiments and a trawl of the list archive suggests that it
won't have any effect on a formatter created with -
initWithFormat:allowsNaturalLanguage:. Can anyone advise on this?
Regards,
Jeremy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden