« get me outta code hell

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:
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~