MatthewYork / DateTools

Dates and times made easy in iOS
MIT License
7.22k stars 952 forks source link

timeAgo() should test smaller durations first #283

Open JetForMe opened 5 years ago

JetForMe commented 5 years ago

The implementation of timeAgo() first checks years, then months, then days, etc. This results in a situation where times jump from a few minutes ago to a full day ago. For example, say it's currently 00:25, and you're looking at a time 24 minutes ago. You get, as you would expect, "24 minutes ago". But if you look at a time 26 minutes ago, you get "1 day ago," which is arguably not what you want.

Instead, you want seconds ago to grow to minutes ago to grow to hours ago to grow to days ago, etc.