What to do about Date not serializable when calling getServerSideProps?

https://clips.twitch.tv/DrabPatientKathyArsonNoSexy-O_B1C2XYw_9SFEg2 Do I have to use multiple types or is there a way around this?
Twitch
Theo - InferGetServerSideProps says it has a date object, I can tru...
Watch Theo's clip titled "InferGetServerSideProps says it has a date object, I can trust it ....right??"
Solution:
/** * Run build or dev with SKIP_ENV_VALIDATION` to skip env validation. This is especially useful * for Docker builds. */ await import("./src/env.mjs");...
Jump to solution
3 Replies
jackmcbride_98
jackmcbride_989mo ago
Found the solution, use withsuperjson
Solution
jackmcbride_98
jackmcbride_989mo ago
/** * Run build or dev with SKIP_ENV_VALIDATION to skip env validation. This is especially useful * for Docker builds. */ await import("./src/env.mjs"); import { withSuperjson } from "next-superjson"; /** @type {import("next").NextConfig} */ const config = { reactStrictMode: true, /** * If you are using appDir then you must comment the below i18n config out. * * @see https://github.com/vercel/next.js/issues/41980 */ i18n: { locales: ["en"], defaultLocale: "en", }, }; export default withSuperjson()(config);
jackmcbride_98
jackmcbride_989mo ago
Here's my next.config.mjs