Introduce a dateAdded field in content config

This commit is contained in:
Maciej Pędzich 2023-09-03 03:58:03 +02:00
parent d36de6ccbd
commit 9449d528f2
2 changed files with 5 additions and 0 deletions

View File

@ -1,5 +1,6 @@
{
"name": "Placeholder",
"dateAdded": "2023-09-02T18:50:00.066Z",
"description": "This is a placeholder cat with a photo taken from placekitten.com",
"image": {
"src": "/images/maciejpedzich-placeholder.jpg",

View File

@ -4,6 +4,10 @@ const cats = defineCollection({
type: 'data',
schema: z.object({
name: z.string(),
dateAdded: z
.string()
.or(z.date())
.transform((val) => new Date(val)),
description: z.string().max(250),
image: z.object({
src: z.string(),