diff --git a/src/app/(admin)/dashboard/_components/url-form-card.tsx b/src/app/(admin)/dashboard/_components/url-form-card.tsx
index c2eb679..36c6323 100644
--- a/src/app/(admin)/dashboard/_components/url-form-card.tsx
+++ b/src/app/(admin)/dashboard/_components/url-form-card.tsx
@@ -213,7 +213,7 @@ function EditUrlForm({ data }: { data: typeof urls.$inferSelect }) {
slug: data.slug,
title: data.title || null,
maxVisits: data.maxVisits || null,
- expDate: data.expDate || undefined,
+ expDate: data.expDate || null,
forwardQueryParams: data.forwardQueryParams,
crawlable: data.crawlable
}
@@ -369,7 +369,9 @@ function EditUrlForm({ data }: { data: typeof urls.$inferSelect }) {
{
+ field.onChange(e instanceof Date ? e : null)
+ }}
/>
diff --git a/src/components/date-picker.tsx b/src/components/date-picker.tsx
index 407373f..83520a8 100644
--- a/src/components/date-picker.tsx
+++ b/src/components/date-picker.tsx
@@ -10,7 +10,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover
import { cn } from "@/lib/utils"
interface DatePickerProps {
- value?: Date
+ value?: Date | null
onChange?: (date: Date | undefined) => void
}
@@ -35,8 +35,9 @@ export function DatePicker({
diff --git a/src/lib/schema/url.ts b/src/lib/schema/url.ts
index a769797..2a01974 100644
--- a/src/lib/schema/url.ts
+++ b/src/lib/schema/url.ts
@@ -20,7 +20,7 @@ export const editUrlSchema = z.object({
slug: z.string().max(10, "Slug must be 10 characters or less"),
title: z.string().max(100, "Title must be 100 characters or less").transform(v => v.trim() === "" ? null : v).nullable(),
maxVisits: z.number().int().positive().nullable(),
- expDate: z.date().optional(),
+ expDate: z.date().nullable(),
forwardQueryParams: z.boolean(),
crawlable: z.boolean(),
})
\ No newline at end of file