Open futuretap opened 7 years ago
👍 Having "One year ago", "One month ago", "One week ago", "Yesterday" instead of "Last year", "Last month", "Last week", "Yesterday" would be less ambiguous.
@futuretap If having a "1 year ago" written as digit is okay for you, you can use myDateVariable.timeAgo(since: Date(), numericDates: true, numericTimes: false)
or the Objective-C equivalent.
Thanks for the useful tip. That's at least a workaround until this is fixed.
I then replaced the out string of myDateVariable.timeAgo(since: Date(), numericDates: true, numericTimes: false)
from
NSLocalizedString("1 year ago", tableName: "DateTools", bundle: Bundle.dateToolsBundle(), value: "", comment: "")
NSLocalizedString("1 month ago", tableName: "DateTools", bundle: Bundle.dateToolsBundle(), value: "", comment: "")
NSLocalizedString("1 week ago", tableName: "DateTools", bundle: Bundle.dateToolsBundle(), value: "", comment: "")
NSLocalizedString("1 day ago", tableName: "DateTools", bundle: Bundle.dateToolsBundle(), value: "", comment: "")
to my own strings
We've been running into issues with this, where the results make sense for 'blocks of days/weeks/months ago' but don't match up to what a human would expect (about 5/10% of cases). Excuse the format, but here are what we see using DateToolsSwift:
Today (string returned from timeAgo(since:Date)) Today: 13:49PM - 30/4/2018 Published: 21:03PM - 29/4/2018 (clearly yesterday)
2 Days Ago Today: 11:23AM - 30/4/2018 Published: 20:04PM - 27/4/2018 (clearly 3 days ago)
2 Days Ago Today: 11:26AM - 30/4/2018 Published: 21:36PM - 27/4/2018 (clearly 3 days ago)
5 Days Ago Today: 14:44PM - 30/4/2018 Published: 17:43PM - 24/4/2018 (6 days ago)
Last Week Today: 14:48PM - 30/4/2018 Published: 19:06PM - 17/4/2018 (much closer to two weeks ago)
2 weeks ago for publish date 17 days ago
returns
Last year
. I think it should return1 year ago
. IMO, "last year" means every date in 2016 whereas "1 year ago" means every date between 1 year and 2 years ago.