Open this example in the interactive library
Source code
const date = new Date("2026-01-02T13:30:00Z");
console.log(
new Intl.NumberFormat("en", { style: "unit", unit: "kilometer" }).format(3),
);
Sample output
3 km

Open this example in the interactive library
const date = new Date("2026-01-02T13:30:00Z");
console.log(
new Intl.NumberFormat("en", { style: "unit", unit: "kilometer" }).format(3),
);
3 km