From 1d7ef3ca75ca7a3f48c456992e7bd911140adf17 Mon Sep 17 00:00:00 2001
From: lcross2002 <liamdcross@outlook.com>
Date: Wed, 10 Apr 2024 17:20:27 +0100
Subject: [PATCH] fixed adding time travel flights

---
 .../src/components/FlightCreationForm/FlightCreationForm.tsx | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/client/src/components/FlightCreationForm/FlightCreationForm.tsx b/client/src/components/FlightCreationForm/FlightCreationForm.tsx
index 0eccb62..faf4543 100644
--- a/client/src/components/FlightCreationForm/FlightCreationForm.tsx
+++ b/client/src/components/FlightCreationForm/FlightCreationForm.tsx
@@ -44,6 +44,11 @@ function FlightCreationForm() {
       return;
     }
 
+    if (new Date(formValue.departure).getTime() > new Date(formValue.arrival).getTime()) {
+      setError('Arrival time must be after departure time');
+      return;
+    }
+
     setError('');
     setDisabled(true);
 
-- 
GitLab