Updated calendar picker
This commit is contained in:
@@ -213,7 +213,7 @@ function EditUrlForm({ data }: { data: typeof urls.$inferSelect }) {
|
|||||||
slug: data.slug,
|
slug: data.slug,
|
||||||
title: data.title || null,
|
title: data.title || null,
|
||||||
maxVisits: data.maxVisits || null,
|
maxVisits: data.maxVisits || null,
|
||||||
expDate: data.expDate || undefined,
|
expDate: data.expDate || null,
|
||||||
forwardQueryParams: data.forwardQueryParams,
|
forwardQueryParams: data.forwardQueryParams,
|
||||||
crawlable: data.crawlable
|
crawlable: data.crawlable
|
||||||
}
|
}
|
||||||
@@ -369,7 +369,9 @@ function EditUrlForm({ data }: { data: typeof urls.$inferSelect }) {
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
value={field.value}
|
value={field.value}
|
||||||
onChange={field.onChange}
|
onChange={e => {
|
||||||
|
field.onChange(e instanceof Date ? e : null)
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormDescription>
|
<FormDescription>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover
|
|||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
interface DatePickerProps {
|
interface DatePickerProps {
|
||||||
value?: Date
|
value?: Date | null
|
||||||
onChange?: (date: Date | undefined) => void
|
onChange?: (date: Date | undefined) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,8 +35,9 @@ export function DatePicker({
|
|||||||
<PopoverContent className="w-auto p-0" align="start">
|
<PopoverContent className="w-auto p-0" align="start">
|
||||||
<Calendar
|
<Calendar
|
||||||
mode="single"
|
mode="single"
|
||||||
selected={value}
|
selected={value ?? undefined}
|
||||||
onSelect={onChange}
|
onSelect={onChange}
|
||||||
|
weekStartsOn={1}
|
||||||
/>
|
/>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const editUrlSchema = z.object({
|
|||||||
slug: z.string().max(10, "Slug must be 10 characters or less"),
|
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(),
|
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(),
|
maxVisits: z.number().int().positive().nullable(),
|
||||||
expDate: z.date().optional(),
|
expDate: z.date().nullable(),
|
||||||
forwardQueryParams: z.boolean(),
|
forwardQueryParams: z.boolean(),
|
||||||
crawlable: z.boolean(),
|
crawlable: z.boolean(),
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user