From fb62911f7645bb33e5d0eaa2c3b4c42d31e730d7 Mon Sep 17 00:00:00 2001 From: Alec Li Date: Wed, 28 Feb 2024 21:40:49 -0800 Subject: [PATCH] Add trimming to spacetime edit validation --- .../frontend/src/components/section/SpacetimeEditModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csm_web/frontend/src/components/section/SpacetimeEditModal.tsx b/csm_web/frontend/src/components/section/SpacetimeEditModal.tsx index 91e5a6f0..34e95aa8 100644 --- a/csm_web/frontend/src/components/section/SpacetimeEditModal.tsx +++ b/csm_web/frontend/src/components/section/SpacetimeEditModal.tsx @@ -48,7 +48,7 @@ const SpaceTimeEditModal = ({ */ const validateSpacetime = (): boolean => { // validate spacetime fields - if (location === null || location === undefined || location.length === 0) { + if (location === null || location === undefined || location.trim() === "") { setValidationText("All section locations must be specified"); return false; } else if (isPermanent && day <= 0) { @@ -60,7 +60,7 @@ const SpaceTimeEditModal = ({ return false; } - if (!isPermanent && (date === null || date === "")) { + if (!isPermanent && (date === null || date.trim() === "")) { setValidationText("Section date to override must be specified"); return false; }