aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-04-29 21:39:32 +0200
committerlonkaars <loek@pipeframe.xyz>2021-04-29 21:39:32 +0200
commitba2cec1c3736cf0fc43db23eb7baa9848f6fb513 (patch)
tree0975c5f0ec3c6470c61df906ddfc0c14a27975f8
parent8abb448b0b67e2c823b96a949446bce909e9452d (diff)
sort by date
-rw-r--r--index.ts9
-rw-r--r--makefile3
2 files changed, 12 insertions, 0 deletions
diff --git a/index.ts b/index.ts
index 07013ce..8048c6a 100644
--- a/index.ts
+++ b/index.ts
@@ -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;
diff --git a/makefile b/makefile
index ccfe6bd..3446912 100644
--- a/makefile
+++ b/makefile
@@ -2,3 +2,6 @@ all:
mkdir out
node .
+clean:
+ rm -r out
+