I noticed on the home page the examples aren't exactly portraying what the correct output should be:
I did a bit of testing to see what the actual output is supposed to be:
> formatDistance(subDays(new Date(), 3), new Date())
'3 days'
> formatDistance(subDays(new Date(), 3), new Date(), { addSuffix: true })
'3 days ago'
> formatRelative(subDays(new Date(), 3), new Date())
'last Sunday at 7:43 PM'
So the two changes I made are:
In order to display the ago text at the end, formatDistance needs { addSuffix: true }. Another possible solve is to just remove the ago text in the comment. I can change that if desired, just let me know.
formatRelative doesn't display p.m., it displays PM.
I noticed on the home page the examples aren't exactly portraying what the correct output should be:
I did a bit of testing to see what the actual output is supposed to be:
So the two changes I made are:
ago
text at the end,formatDistance
needs{ addSuffix: true }
. Another possible solve is to just remove theago
text in the comment. I can change that if desired, just let me know.formatRelative
doesn't displayp.m.
, it displaysPM
.