Skip to content

Commit

Permalink
Fix create event mutation [Fixes part of PalisadoesFoundation#1101 in…
Browse files Browse the repository at this point in the history
… Talawa-API] (PalisadoesFoundation#523)

* Add format fix

* Fix updation of posts
  • Loading branch information
EshaanAgg authored Mar 4, 2023
1 parent ea15e91 commit d40d001
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/components/EventListCard/EventListCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ function EventListCard(props: EventListCardProps): JSX.Element {
title: '',
eventdescrip: '',
location: '',
startTime: '',
endTime: '',
startTime: '08:00:00',
endTime: '18:00:00',
});

useEffect(() => {
setFormState({
title: props.eventName,
eventdescrip: props.eventDescription,
location: props.eventLocation,
startTime: props.startTime,
endTime: props.endTime,
startTime: props.startTime?.split('.')[0] || '08:00:00',
endTime: props.endTime?.split('.')[0] || '18:00:00',
});

setAllDayChecked(props.allDay);
Expand Down Expand Up @@ -92,8 +92,8 @@ function EventListCard(props: EventListCardProps): JSX.Element {
isRegisterable: registrablechecked,
allDay: alldaychecked,
location: formState.location,
startTime: formState.startTime,
endTime: formState.endTime,
startTime: !alldaychecked ? formState.startTime + 'Z' : null,
endTime: !alldaychecked ? formState.endTime + 'Z' : null,
},
});

Expand Down
17 changes: 9 additions & 8 deletions src/screens/OrganizationEvents/OrganizationEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CREATE_EVENT_MUTATION } from 'GraphQl/Mutations/mutations';
import { RootState } from 'state/reducers';
import PaginationList from 'components/PaginationList/PaginationList';
import debounce from 'utils/debounce';
import dayjs from 'dayjs';

function OrganizationEvents(): JSX.Element {
const { t } = useTranslation('translation', {
Expand All @@ -43,8 +44,8 @@ function OrganizationEvents(): JSX.Element {
eventdescrip: '',
date: '',
location: '',
startTime: '',
endTime: '',
startTime: '08:00:00',
endTime: '18:00:00',
});
const currentUrl = window.location.href.split('=')[1];

Expand Down Expand Up @@ -83,12 +84,12 @@ function OrganizationEvents(): JSX.Element {
recurring: recurringchecked,
isRegisterable: registrablechecked,
organizationId: currentUrl,
startDate: startDate?.toDateString(),
endDate: endDate?.toDateString(),
startDate: dayjs(startDate).format('YYYY-MM-DD'),
endDate: dayjs(endDate).format('YYYY-MM-DD'),
allDay: alldaychecked,
location: formState.location,
startTime: formState.startTime,
endTime: formState.endTime,
startTime: !alldaychecked ? formState.startTime + 'Z' : null,
endTime: !alldaychecked ? formState.endTime + 'Z' : null,
},
});

Expand All @@ -101,8 +102,8 @@ function OrganizationEvents(): JSX.Element {
eventdescrip: '',
date: '',
location: '',
startTime: '',
endTime: '',
startTime: '08:00:00',
endTime: '18:00:00',
});
}
} catch (error: any) {
Expand Down

0 comments on commit d40d001

Please sign in to comment.