From 8e3cc296020f34075ac6db7b7e4782048c45d68a Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Mon, 26 Feb 2024 19:53:47 +0100 Subject: [PATCH] Update experiences sorting --- src/composables/useContent.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/composables/useContent.ts b/src/composables/useContent.ts index a65c1b6..88d6de1 100644 --- a/src/composables/useContent.ts +++ b/src/composables/useContent.ts @@ -17,12 +17,11 @@ export function getEducations() { } export function getWorkExperiences() { - return useAsyncData('content:experiences', () => { - return queryContent('experiences') - .sort({ - endDate: -1, - }) - .find() + return useAsyncData('content:experiences', async () => { + const experiences = await queryContent('experiences').find() + return experiences.sort((a, b) => { + return new Date(b.startDate).getTime() - new Date(a.startDate).getTime() + }) }) }