Skip to content

Commit

Permalink
Fix version ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
TomWright committed Feb 11, 2021
1 parent 53180cb commit 4190ec1
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions frontend/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,33 @@
if (b.label === 'latest') {
return 1
}
if (a.label < b.label) {
let aSplit = a.label.replace(/^v/,"").split(".")
let bSplit = a.label.replace(/^v/,"").split(".")
// Major
if (aSplit[0] < bSplit[0]) {
return 1
}
if (bSplit[0] < aSplit[0]) {
return -1
}
// Minor
if (aSplit[1] < bSplit[1]) {
return 1
}
if (b.label < a.label) {
if (bSplit[1] < aSplit[1]) {
return -1
}
// Patch
if (aSplit[2] < bSplit[2]) {
return 1
}
if (bSplit[2] < aSplit[2]) {
return -1
}
return 0;
}
Expand Down

0 comments on commit 4190ec1

Please sign in to comment.