Remove redundant AM/PM when formatting a time range?
Remove redundant AM/PM when formatting a time range?
- Subject: Remove redundant AM/PM when formatting a time range?
- From: Ben Kazez <email@hidden>
- Date: Fri, 11 Apr 2014 17:41:53 +0200
Hello,
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?
Specifically, I’m concerned that (1) in some languages, I might have to remove it from the end time, not the start, and (2) the spaces will get in the way of removing the redundant AM/PM.
Even if I can only make it work for a few languages (perhaps just by modifying the format string returned from -dateFormatFromTemplate?), it seems it would be worth it for the human-friendly result.
Ben
_______________________________________________
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