From 3285d9f6d92955a18312bf05ffe74a1bfcdf5934 Mon Sep 17 00:00:00 2001 From: Xevion Date: Tue, 28 Nov 2023 04:16:31 -0600 Subject: [PATCH] Disable date-fns-tz timezone offset solution, add thoughts, revert --- src/content/config.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/content/config.ts b/src/content/config.ts index 8992655..fcd5b95 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -1,6 +1,6 @@ import { z, defineCollection } from "astro:content"; import { parse } from "date-fns"; -import { zonedTimeToUtc } from "date-fns-tz"; +// import { zonedTimeToUtc } from "date-fns-tz"; const blogCollection = defineCollection({ type: "content", // v2.5.0 and later @@ -8,10 +8,13 @@ const blogCollection = defineCollection({ title: z.string(), description: z.string(), pubDate: z.string().transform((date) => { + // I am truly lost on how TZ works in Javascript Dates. + // I believe somehow the solution would lie here in making sure that the date offset is parsed and transmitted properly, + // but there is no insight in how this works so far. I'm lost as fuck. const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; const parsed = parse(date, "yyyy-MM-dd HH:mm:ss XX", new Date()); - const utc = zonedTimeToUtc(parsed, timezone); - return z.date().parse(utc); + // const utc = zonedTimeToUtc(parsed, timezone); + return z.date().parse(parsed); }), tags: z.array(z.string()), preview_image: z.string().optional(),