Open this example in the interactive library
Source code
console.log(
new Intl.RelativeTimeFormat("en-US", { numeric: "auto" }).format(
-1,
"day",
),
);
Sample output
yesterday

Open this example in the interactive library
console.log(
new Intl.RelativeTimeFormat("en-US", { numeric: "auto" }).format(
-1,
"day",
),
);
yesterday