Updated calendar picker
This commit is contained in:
@@ -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 }) {
|
||||
<FormControl>
|
||||
<DatePicker
|
||||
value={field.value}
|
||||
onChange={field.onChange}
|
||||
onChange={e => {
|
||||
field.onChange(e instanceof Date ? e : null)
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormDescription>
|
||||
|
||||
@@ -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({
|
||||
<PopoverContent className="w-auto p-0" align="start">
|
||||
<Calendar
|
||||
mode="single"
|
||||
selected={value}
|
||||
selected={value ?? undefined}
|
||||
onSelect={onChange}
|
||||
weekStartsOn={1}
|
||||
/>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
|
||||
@@ -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(),
|
||||
})
|
||||
Reference in New Issue
Block a user