Open this example in the interactive library
Source code
const date = new Date("2026-01-02T13:30:00Z");
console.log(
["v10", "v2", "v1"].sort(new Intl.Collator("en", { numeric: true }).compare),
);
Sample output
[ 'v1', 'v2', 'v10' ]

Open this example in the interactive library
const date = new Date("2026-01-02T13:30:00Z");
console.log(
["v10", "v2", "v1"].sort(new Intl.Collator("en", { numeric: true }).compare),
);
[ 'v1', 'v2', 'v10' ]