diff options
author | lonkaars <loek@pipeframe.xyz> | 2021-04-29 21:39:32 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2021-04-29 21:39:32 +0200 |
commit | ba2cec1c3736cf0fc43db23eb7baa9848f6fb513 (patch) | |
tree | 0975c5f0ec3c6470c61df906ddfc0c14a27975f8 | |
parent | 8abb448b0b67e2c823b96a949446bce909e9452d (diff) |
sort by date
-rw-r--r-- | index.ts | 9 | ||||
-rw-r--r-- | makefile | 3 |
2 files changed, 12 insertions, 0 deletions
@@ -43,6 +43,15 @@ downloads.each(async (i, el) => { } versions.push(version); if( i == downloadCount - 1 ) { + versions = versions.sort((a, b) => { + var dateFormat = /(\d{2})\.(\d{2})\.(\d{4})/; + var aR = a.date.match(dateFormat); + var bR = b.date.match(dateFormat); + return ( new Date(Number(bR[3]), Number(bR[2]) - 1, Number(bR[1])).getTime() ) - + ( new Date(Number(aR[3]), Number(aR[2]) - 1, Number(aR[1])).getTime() ); + }); + console.log(versions) + var minecraftVersions = {}; var latest: types.OptifineVersion; var latestPre: types.OptifineVersion; @@ -2,3 +2,6 @@ all: mkdir out node . +clean: + rm -r out + |