From cc8fa20531ddc4f3541b78e0791e302811283476 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Tue, 7 Mar 2023 21:58:46 -0800 Subject: [PATCH] ...fix sort bug --- src/pages/photogallery.tsx | 4 ++-- src/utils.ts | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/pages/photogallery.tsx b/src/pages/photogallery.tsx index b09d664..b149c29 100644 --- a/src/pages/photogallery.tsx +++ b/src/pages/photogallery.tsx @@ -277,7 +277,7 @@ const GalleryPage = ({ data }: PageProps) => { - {/* ) => { filterKeyword, }} showPalette={showPalette} - /> */} + /> ); }; diff --git a/src/utils.ts b/src/utils.ts index 89be968..bf033c3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -140,12 +140,9 @@ export function compareDates( left: T, right: T ): number { - const d1 = pathOr("", date_path, left); - console.log("🚀 ~ file: utils.ts:129 ~ d1:", d1); - const date1 = new Date(d1); - console.log("🚀 ~ file: utils.ts:146 ~ new Date(d1):", new Date(d1)) - console.log("🚀 ~ file: utils.ts:133 ~ date1:", date1); - const date2 = new Date(pathOr("", date_path, right)); + // why tf do my dates have newlines in them?!?! + const date1 = new Date(pathOr("", date_path, left).replace(/\s/g, '')); + const date2 = new Date(pathOr("", date_path, right).replace(/\s/g, '')); const diff = -1 * (date1.getTime() - date2.getTime()); return diff; }