-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Have editMeetingTimes use same funcs as createMeetingTimes #1592
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,13 +41,10 @@ const EditMeetingTimes = ({ | |
}; | ||
} | ||
|
||
//if there is a description or a blank description | ||
if (values.description || !values.description) { | ||
theUpdatedEvent = { | ||
...theUpdatedEvent, | ||
description: values.description, | ||
}; | ||
} | ||
theUpdatedEvent = { | ||
...theUpdatedEvent, | ||
description: values.description, | ||
}; | ||
|
||
if (values.videoConferenceLink) { | ||
theUpdatedEvent = { | ||
|
@@ -63,50 +60,23 @@ const EditMeetingTimes = ({ | |
updatedDate, | ||
}; | ||
|
||
// If the day has been changed, find the next occurence of the changed day | ||
if (values.day) { | ||
const date = findNextOccuranceOfDay(values.day); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This portion of the code is what creates a false time stamp. This is the most relevant changes to this PR |
||
const dateGMT = new Date(date).toISOString(); | ||
|
||
theUpdatedEvent = { | ||
...theUpdatedEvent, | ||
date: dateGMT, | ||
}; | ||
} | ||
|
||
// Set start time, End time and Duration if either start time or duration is changed | ||
if (values.startTime || values.duration) { | ||
/* | ||
We need a start time and a duration to calculate everything we need. | ||
If only the start time or only the duration is changing, | ||
we use the previous time or duration for the calculation. | ||
*/ | ||
// Find next occurance of Day in the future | ||
// Assign new start time and end time | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In |
||
const date = findNextOccuranceOfDay(values.day); | ||
const startTimeDate = timeConvertFromForm(date, values.startTime); | ||
const endTime = addDurationToTime(startTimeDate, values.duration); | ||
|
||
let startTimeToUse = startTimeOriginal; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Getting rid of the old timing code |
||
let durationToUse = durationOriginal; | ||
|
||
if (values.startTime) { | ||
startTimeToUse = values.startTime; | ||
} | ||
|
||
if (values.duration) { | ||
durationToUse = values.duration; | ||
} | ||
|
||
const timeDate = timeConvertFromForm(new Date(), startTimeToUse); | ||
const endTime = addDurationToTime(timeDate, durationToUse); | ||
|
||
// convert to ISO and GMT | ||
const startTimeGMT = new Date(timeDate).toISOString(); | ||
const endTimeGMT = new Date(endTime).toISOString(); | ||
|
||
theUpdatedEvent = { | ||
...theUpdatedEvent, | ||
startTime: startTimeGMT, | ||
endTime: endTimeGMT, | ||
hours: durationToUse, | ||
}; | ||
} | ||
// Revert timestamps to GMT | ||
const startDateTimeGMT = new Date(startTimeDate).toISOString(); | ||
const endTimeGMT = new Date(endTime).toISOString(); | ||
|
||
theUpdatedEvent = { | ||
...theUpdatedEvent, | ||
date: startDateTimeGMT, | ||
startTime: startDateTimeGMT, | ||
endTime: endTimeGMT, | ||
duration: values.duration | ||
}; | ||
|
||
updateRecurringEvent(theUpdatedEvent, eventID); | ||
showSnackbar("Recurring event updated", 'info') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This portion of the code always evaluates to
true
, removed if blockThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lolol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this should be
if (values.description) {