content-collections
content-collections copied to clipboard
schema is only validation? can we account for coercion too?
It'd be nice to be able to use zod coercion to turn yaml ISO date strings into JS Date objects.
z.string().pipe(z.coerce.date())
z.string().transform((value) => new Date(value))
but these end up creating typeerrors:
You can use coerce or transform, but the output must be a valid JSON object since content collections store documents as JSON files. There is an existing issue addressing the problem with the date (#29).