Re: Remove redundant AM/PM when formatting a time range?
Re: Remove redundant AM/PM when formatting a time range?
- Subject: Re: Remove redundant AM/PM when formatting a time range?
- From: Jens Alfke <email@hidden>
- Date: Fri, 11 Apr 2014 09:12:05 -0700
On Apr 11, 2014, at 8:41 AM, Ben Kazez <email@hidden> wrote:
> I’m trying to create a compact time range format, like “2am-4pm” or “2-5:30pm”. I am constructing the format string using -dateFormatFromTemplate:options:locale:, omitting the minutes from the template if that component is zero. Is there an internationalization-safe way that I can remove the AM/PM from one of the times if it is redundant? What about the space, if a locale considers that space optional?
Can you do this by making the format strings themselves localizable? For instance you might have special format string IDs for use when both times are AM or both PM, one for the first time and one for the second. The localizer can then decide which of those two format strings should drop the AM/PM indicator.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden