Make NSDateFormatter's relative date formatting actually useful

Originator:futuretap
Number:rdar://30448374 Date Originated:09-Feb-2017 09:01 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:10.2
Classification:Enhancement Reproducible:Always
 
Using the doesRelativeDateFormatting option in NSDateFormatter is not very useful. It lacks the following features:

- Return a relative date for anything that is before yesterday or after tomorrow. It should return "last week", "2 months ago", "in 5 days" etc., instead of the absolute date.
  - If the current behavior is considered as intended (looks like Finder uses it), I'd like to lobby for a "limitRelativeDateFormattingTimeInterval" property that limits the interval into the future and into the past where relative formatting is used. Example: Setting it to 7*24*60*60 would limit relative dates one week into the past and into the future; otherwise absolute dates are returned.

- It doesn't support parsing relative dates. (Of course something like "a year ago" can't yield an exact date. Best-effort would be enough!)

Btw, the documentation lacks a statement about the limitations.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!