🔀 Merge pull request #47 from Ayush272002/sid-visual-fixes

🦺 Added constraints to ensure valid year inputs when hosting events
This commit is contained in:
Sid
2024-10-27 07:05:46 +00:00
committed by GitHub

View File

@@ -94,6 +94,8 @@ const EventForm = ({ onSubmit }: EventFormProps) => {
setValue('images', updatedImages);
};
const currentDateTime = new Date().toISOString().slice(0, 16);
return (
<form onSubmit={handleSubmit(onSubmit)} className="space-y-4">
{/* Name Field */}
@@ -153,6 +155,8 @@ const EventForm = ({ onSubmit }: EventFormProps) => {
type="datetime-local"
id="eventStartTime"
{...register('eventStartTime')}
min={currentDateTime}
max="2100-12-31T23:59"
/>
{errors.eventStartTime && (
<p className="text-red-500">{errors.eventStartTime.message}</p>
@@ -166,6 +170,8 @@ const EventForm = ({ onSubmit }: EventFormProps) => {
type="datetime-local"
id="eventEndTime"
{...register('eventEndTime')}
min={currentDateTime}
max="2100-12-31T23:59"
/>
{errors.eventEndTime && (
<p className="text-red-500">{errors.eventEndTime.message}</p>