Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Fix text input for dates.

Matthieu Hochlander18616cce8462
diff --git a/src/components/admin/text-input.tsx b/src/components/admin/text-input.tsx
index b08e584a..19ed4b4e 100644
--- a/src/components/admin/text-input.tsx
+++ b/src/components/admin/text-input.tsx
@@ -33,6 +33,13 @@ export const TextInput = (props: TextInputProps) => {
} = props;
const { id, field, isRequired } = useInput(props);
+ const value =
+ props.type === "datetime-local"
+ ? field.value?.slice(0, 16) // Adjust for datetime-local input format
+ : props.type === "date"
+ ? field.value?.slice(0, 10) // Adjust for date input format
+ : field.value;
+
return (
<FormField id={id} className={cn(className, "w-full")} name={field.name}>
{label !== false && (
@@ -47,9 +54,9 @@ export const TextInput = (props: TextInputProps) => {
)}
<FormControl>
{multiline ? (
- <Textarea {...rest} {...field} />
+ <Textarea {...rest} {...field} value={value} />
) : (
- <Input {...rest} {...field} />
+ <Input {...rest} {...field} value={value} />
)}
</FormControl>
<InputHelperText helperText={props.helperText} />