Thanks, Jon. That's exactly what I did, except for the rules around when to 
change formats, and this, which I don't understand:

"For yesterday, today, and tomorrow you just use the built in natural language 
formatter."

Which formatter is this?

On Feb 24, 2010, at 17:08:14, Jon Hull wrote:

> I wrote a fully localized calendar control for 10.2 (even supported
> Japanese properly :-), but stopped supporting it when apple came out with
> their own official calendar control.  At the time I had to roll my own to
> get the best behavior.  It is really easy to do though...
> 
> For yesterday, today, and tomorrow you just use the built in natural
> language formatter. For less than 7 days, you use the localized day of the
> week (%A). I used a "month day" (%B %e) format for a few months after that
> (unless there was a year break), and then a "month day, year" (%b %e,%Y)
> format for anything too far out in the future, past the new year, or
> anything before yesterday.
> 
> Basically, you are building a custom formatter that passes the problem to
> different built-in formatters depending on how far away the date is.  My
> primary computer is in the shop or I would post the code (I'll try to
> remember when I get it back).  You should be able to figure it out for
> yourself though... it is only 2 methods IIRC.  Might be a little different
> with the new date objects though, haven't looked at it in a while (I think
> you have to use unicode syntax now, but the theory should be the same).
> 
> Thanks,
> Jon
> 
> 
> On Wed, 24 Feb 2010 12:04:45 -0800, Rick Mann <[email protected]>
> wrote:
>> I'd like to take an NSDate and get a relative day-of-week name. For
>> example, if today is 2/24, and the NSDate is some time on 2/23, it would
> be
>> "Yesterday." If the NSDate were 2/22, it would be "Monday."
>> 
>> Is there an existing format specifier for this (fully localized, etc)? Or
>> must I roll my own for this?
>> 
>> 
> 

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to