Writing "posted 2 days ago" correctly
Relative time is how most apps show dates: a comment posted "yesterday", a deploy "3 hours ago", a sale ending "in 2 days". It reads better than a full date, but it hides a few choices. This page shows those choices so you can check what your own code should say.
Say a comment was posted at 2026-12-02T18:00 and you are reading it at 2026-12-04T12:00. Type the first date, and the second into "Compared with". The relative form is "1 day ago", because the gap is 1 day and 18 hours and the page rounds down. The everyday wording is "yesterday", which is what Intl.RelativeTimeFormat gives with numeric set to "auto". The exact difference is 1 day and 18 hours.
Rounding down is a choice, and it explains most of the "that is wrong" reports such labels get. With rounding to the nearest unit instead, 1 day and 18 hours would be "2 days ago", which feels odd for something posted the day before yesterday evening. Rounding down never claims more time has passed than really has. The cost is that 23 hours and 59 minutes still says "23 hours ago".
Months and years are counted with average lengths, because a relative label has no room for "1 month and 3 days". A gap of 400 days is "1 year ago", and in everyday words "last year". If you need whole calendar months, for a billing period or an age, use Date Difference, which counts real months.
There are limits. The page compares two moments; it does not know about business hours or time spent away. The everyday wording comes from your browser, so it can differ slightly between browsers and versions. And a date typed without an offset is read in your device's zone, so the same text can mean a different moment on someone else's computer.