catamphetamine / javascript-time-ago

International highly customizable relative date/time formatting

Home Page:https://catamphetamine.gitlab.io/react-time-ago/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion: "Yesterday" instead of "a day ago"

oferRounds opened this issue · comments

Perhaps there are more similar issues?
I think Facebook post’s creation time is a good reference

Consider a situation when a post was created at 23:59:59 and on 00:00:01 it says "yesterday", even though it's really just "a couple of seconds earlier".
"Yesterday" is ambiguous, that's why this library doesn't use it.

But then you could use 'a minute ago'. I say: for the cases the library choose 'a day ago' -> choose 'yesterday'

But then you could use 'a minute ago'. I say: for the cases the library choose 'a day ago' -> choose 'yesterday'

Hmm, that's a valid point.
Still, I find it ambiguous enough: at 00:01 "yesterday" is not that informative.
It's true that from the library's use case, "yesterday" is always at least "a day ago".
But when considered in isolation, for a person, not familiar with its inner workings, "yesterday" is too value at 00:01.
I know how this library works, so I know that "yesterday" is "a day ago", but a random person doesn't know that, and could be confused.
Furthermore, consider a case when at 00:01 it says "yesterday" for a post that has been posted "a day before yesterday": this could happen, because the time difference is rounded to either "1 day earlier" or "2 days earlier", so for 1.49 * 24 hours earlier it'll still say "yesterday", so if a post has been posted at 22:00 Monday, and a user scrolls the feed at 03:00 Wednesday, then the time difference is more than a day but less than one and a half days, so it'll say "a day ago" with the current config (which still isn't accurate enough, but at least it doesn't set the strict from-to bounds), and it would say "yesterday" if "yesterday" was used instead (setting strict from-to bounds), which would be incorrect, because that would really be "a day before yesterday".
"Yesterday", "today" and "tomorrow" are relics of the past, when people were peasants, didn't have electricity, got up at 4 a.m. and went to sleep at 21 p.m.. Modern globalized civilization blurs the borders on what "yesterday"/"today"/"tomorrow" is: my "today" is someone's "yesterday", and it all happens simultaneously, and some people are up at night sleeping at day, etc.
We'll leave this issue open though, so that other users searching for "yesterday" could read the rationale.

I think a valid use case is like WhatsApp message style, where the messages are grouped under the day it was sent.
The individual message doesn't have to show it's timestamp as yesterday, but the message group heading will indicate the message was sent/received yesterday.

@Esirei And then it would have nothing to do with this library.