fix: sorting
This commit is contained in:
parent
10a9d87926
commit
38f2677cd2
2 changed files with 16 additions and 2 deletions
|
|
@ -4,7 +4,14 @@ import { getCollection } from "astro:content";
|
|||
|
||||
const title = "gists";
|
||||
const gists = await getCollection("gists");
|
||||
gists.sort((a, b) => a.slug.localeCompare(b.slug));
|
||||
gists.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);
|
||||
});
|
||||
---
|
||||
|
||||
<BaseLayout title={title}>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,14 @@ import { getCollection } from "astro:content";
|
|||
|
||||
const title = "git repos";
|
||||
const repos = await getCollection("git");
|
||||
repos.sort((a, b) => a.slug.localeCompare(b.slug));
|
||||
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);
|
||||
});
|
||||
---
|
||||
|
||||
<BaseLayout title={title}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue