mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-09-26 03:59:05 +02:00
Also compare length to handle longer ID on newest/oldest
This commit is contained in:
parent
2a238836a1
commit
c420d49025
1 changed files with 2 additions and 16 deletions
|
@ -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":
|
||||
|
|
Loading…
Reference in a new issue