MatthewYork/DateTools

timeAgo() should test smaller durations first

Opened this issue · 0 comments

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.