fix: date checker edge case fix (#443)

This commit is contained in:
Anmol Singh Bhatia 2023-03-15 17:41:24 +05:30 committed by GitHub
parent 928ebdf632
commit 164072e3cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,8 +56,7 @@ export const CycleForm: React.FC<Props> = ({ 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<Props> = ({ 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<Props> = ({ 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,