Fix dates and finish Tiny Accident

This commit is contained in:
Bad Manners 2024-03-25 11:36:54 -03:00
parent 808f565e59
commit b92f53a9c2
6 changed files with 86 additions and 71 deletions

View file

@ -1,5 +1,8 @@
import { defineCollection, reference, z } from "astro:content";
export const adjustDateForUTCOffset = (date: Date) =>
new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
export const WEBSITE_LIST = [
"website",
"eka",
@ -27,7 +30,7 @@ const storiesCollection = defineCollection({
z.object({
// Required
title: z.string(),
pubDate: z.date(),
pubDate: z.date().transform(adjustDateForUTCOffset),
wordCount: z.number().int(),
contentWarning: z.string(),
description: z.string(),
@ -59,7 +62,7 @@ const gamesCollection = defineCollection({
z.object({
// Required
title: z.string(),
pubDate: z.date(),
pubDate: z.date().transform(adjustDateForUTCOffset),
contentWarning: z.string(),
description: z.string(),
tags: z.array(z.string()),