0

I want to display friendly format date just like whatsapp and telegram do. For example, for today's date it shows "today" and yesterday date it shows "yesterday". But I don't want to show three days before as "3 days ago". It should be the regular date like this "Sun, 7 Jul 2019".

I don't have any custom to the current code because it still uses the example from the repo. But I tried to change the format but none of that works.

Muhaimin CS
  • 195
  • 2
  • 19

1 Answers1

0

What does your code look like? You'd have to do some logic like

if (daysAgo > -2) {
  return <FormattedRelativeTime numeric="auto" unit="day" value={daysAgo} />
}
return <FormattedDate weekday="short" day="numeric" month="short" year="numeric" value={ts} />
Long Ho
  • 599
  • 4
  • 15