« get me outta code hell

fix misordered art lists & chronology links - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-08-02 16:15:57 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-08-02 16:15:57 -0300
commit9ff95d1c338d8a194c91d90b3f8fccf59442da03 (patch)
tree2413c9fe2f4947f9780f764d7f42c96bb312cbe4 /src/util
parent49153bc1b7c6a7a4764004f1359d66bc81c051f6 (diff)
fix misordered art lists & chronology links
Diffstat (limited to 'src/util')
-rw-r--r--src/util/wiki-data.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js
index 87c4b22a..3f24e6a7 100644
--- a/src/util/wiki-data.js
+++ b/src/util/wiki-data.js
@@ -79,11 +79,11 @@ export function sortByName(a, b) {
 // This function was originally made to sort just al8um data, 8ut its exact
 // code works fine for sorting tracks too, so I made the varia8les and names
 // more general.
-export function sortByDate(data) {
+export function sortByDate(data, dateKey = 'date') {
     // Just to 8e clear: sort is a mutating function! I only return the array
     // 8ecause then you don't have to define it as a separate varia8le 8efore
     // passing it into this function.
-    return data.sort((a, b) => a.date - b.date);
+    return data.sort((a, b) => a[dateKey] - b[dateKey]);
 }
 
 // Same details as the sortByDate, 8ut for covers~