Commit a1d7f6e
Changed files (1)
src/content.config.ts
@@ -11,7 +11,19 @@ const typCollection = defineCollection({
title: z.string(),
author: z.string().optional(),
desc: z.any().optional(),
- date: z.any(),
+ date: z.string().transform((str) => {
+ const match = str.match(
+ /datetime\(year:\s*(\d+),\s*month:\s*(\d+),\s*day:\s*(\d+)\)/,
+ );
+ if (match) {
+ return new Date(
+ parseInt(match[1], 10),
+ parseInt(match[2], 10) - 1,
+ parseInt(match[3], 10),
+ );
+ }
+ return z.NEVER;
+ }),
}),
});