Open shehabic-work opened 6 years ago
Here's a PR to fix it in a simpler way, I've seen another PR but I think this one is much simpler. https://github.com/MatthewYork/DateTools/pull/264
I concur. Yesterday should be for > 24h, shouldn't be possible for 1 or 2 min differences.
Since it is returned by a function called timeAgoSinceNow, it should reflect time, not date.
However, @shehabic's fix doesn't actually fix the issue (at least, not in my tests). It never actually shows the "Yesterday" text. I believe that when the .hour is >= 24, it goes to the .day component, never triggering the "Yesterday" return value.
Hello,
First thank you for such great effort,
I wanted to point out that for the logic of Displaying "Yesterday" I strong believe is wrong.
e.g. I'm using it in a news app, showing if I publish something at 23:59:00 then I start reading it at let's say 00:00:10 it shows "Yesterday" rather than 1 minute ago, I'd limit showing yesterday to more than X hours, I'd say this would be 24 hours, so from 1 - 23 hours I'd still show x hours ago, then after that I starting writing yesterday.