Skip to content

Commit

Permalink
Adv-Reg Date Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
keshav committed Jan 27, 2024
1 parent 134717a commit 019125e
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,24 @@ function advertisementRegister({

const handleRegister = async (): Promise<void> => {
try {
const startDate = dayjs(formState.startDate).format('YYYY-MM-DD');
const endDate = dayjs(formState.endDate).format('YYYY-MM-DD');

if (startDate > endDate) {
toast.error('End Date cannot be earlier than Start Date');
return;

Check warning on line 101 in src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.tsx#L100-L101

Added lines #L100 - L101 were not covered by tests
}

console.log('At handle register', formState);

const { data } = await create({
variables: {
orgId: currentOrg,
name: formState.name as string,
link: formState.link as string,
type: formState.type as string,
startDate: dayjs(formState.startDate).format('YYYY-MM-DD'),
endDate: dayjs(formState.endDate).format('YYYY-MM-DD'),
startDate,
endDate,
},
});

Expand All @@ -123,6 +132,7 @@ function advertisementRegister({
console.log('error occured', error);
}
};

const handleUpdate = async (): Promise<void> => {
try {
const updatedFields: Partial<InterfaceFormStateTypes> = {};
Expand Down

0 comments on commit 019125e

Please sign in to comment.