From 164072e3cced68a13facad8ff2aead6eb2c45e17 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Wed, 15 Mar 2023 17:41:24 +0530 Subject: [PATCH] fix: date checker edge case fix (#443) --- apps/app/components/cycles/form.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/app/components/cycles/form.tsx b/apps/app/components/cycles/form.tsx index 8ab61acc5..1a1632648 100644 --- a/apps/app/components/cycles/form.tsx +++ b/apps/app/components/cycles/form.tsx @@ -56,8 +56,7 @@ export const CycleForm: React.FC = ({ handleFormSubmit, handleClose, stat }; const cycleStatus = - data?.start_date && data?.end_date - ? getDateRangeStatus(data?.start_date, data?.end_date) : ""; + data?.start_date && data?.end_date ? getDateRangeStatus(data?.start_date, data?.end_date) : ""; const dateChecker = async (payload: any) => { await cyclesService @@ -141,7 +140,7 @@ export const CycleForm: React.FC = ({ handleFormSubmit, handleClose, stat value={value} onChange={(val) => { onChange(val); - watch("end_date") && cycleStatus != "current" + val && watch("end_date") && cycleStatus != "current" ? dateChecker({ start_date: val, end_date: watch("end_date"), @@ -169,7 +168,7 @@ export const CycleForm: React.FC = ({ handleFormSubmit, handleClose, stat value={value} onChange={(val) => { onChange(val); - watch("start_date") && cycleStatus != "current" + val && watch("start_date") && cycleStatus != "current" ? dateChecker({ start_date: watch("start_date"), end_date: val,