Also compare length to handle longer ID on newest/oldest

This commit is contained in:
Hans5958 2023-03-19 16:15:04 +07:00
parent 2a238836a1
commit c420d49025

View file

@ -379,26 +379,12 @@ function buildObjectsList(filter = null, sort = null) {
break
case "newest":
sortFunction = function (a, b) {
if (a.id > b.id) {
return -1
}
if (a.id < b.id) {
return 1
}
// a must be equal to b
return 0
return b.id.length - a.id.length || b.id.localeCompare(a.id)
}
break
case "oldest":
sortFunction = function (a, b) {
if (a.id < b.id) {
return -1
}
if (a.id > b.id) {
return 1
}
// a must be equal to b
return 0
return a.id.length - b.id.length || a.id.localeCompare(b.id)
}
break
case "area":