fix: sorting by date

This commit is contained in:
Barrett Ruth 2025-10-12 11:31:00 -04:00
parent 38f2677cd2
commit 5339527461
5 changed files with 20 additions and 35 deletions

View file

@ -1,17 +1,11 @@
---
import BaseLayout from "../layouts/BaseLayout.astro";
import { getCollection } from "astro:content";
import { sortItem } from "../utils/sort.js";
const title = "git repos";
const repos = await getCollection("git");
repos.sort((a, b) => {
const parseEuroDate = (dateStr) => {
if (!dateStr) return new Date(0);
const [day, month, year] = (dateStr || "").split("/");
return new Date(year, month - 1, day);
};
return parseEuroDate(b.data.date) - parseEuroDate(a.data.date);
});
repos.sort(sortItem);
---
<BaseLayout title={title}>