Is it me or is NSDateFormatter's setDoesRelativeDateFormatting: is broken?

Here is the code I use to create a new NSDateFormatter instance:
                        NSDateFormatter *dateFormatter = [[NSDateFormatter 
alloc] initWithDateFormat:@"%Y-%m-%d %H:%M:%S" allowNaturalLanguage:YES];
                        [dateFormatter setLocale:[NSLocale currentLocale]];
                        [dateFormatter setDoesRelativeDateFormatting:YES];
                        [dateFormatter 
setFormatterBehavior:NSDateFormatterBehavior10_4];
                        [dateFormatter setDateStyle:NSDateFormatterShortStyle];
                        [dateFormatter setTimeStyle:NSDateFormatterLongStyle];

When I use stringFromDate:, the date is always output like 4/8/11 3:50:50 PM. I 
was expecting that it would output something more along the line of "Today 
3:50:50 PM" or something like that.

The doc gives this example for setDoesRelativeDateFormatting:

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
NSLocale *frLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"fr_FR"];
[dateFormatter setLocale:frLocale];
 
[dateFormatter setDoesRelativeDateFormatting:YES];
 
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:60*60*24*3];
NSString *dateString = [dateFormatter stringFromDate:date];
 
NSLog(@"dateString: %@", dateString);
// Output
// dateString: après-après-demain

So, what's wrong with this? Am I missing something or is NSDateFormatter 
setDoesRelativeDateFormatting is broken somehow?

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin                                 
http://www.nemesys-soft.com/
Logiciels Nemesys Software                                      
laur...@nemesys-soft.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to