From 9ff95d1c338d8a194c91d90b3f8fccf59442da03 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 2 Aug 2021 16:15:57 -0300 Subject: fix misordered art lists & chronology links --- src/util/wiki-data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/util/wiki-data.js') diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js index 87c4b22..3f24e6a 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~ -- cgit 1.3.0-6-gf8a5