Skip to content

Commit

Permalink
add time to date
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinOehlerkingCap committed Sep 12, 2024
1 parent a9a52c1 commit 50011a4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions controllers/courses.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ const getSyncedElements = (
res,
syncedWithGroup,
) => {
const startDate = course.startDate ? timesHelper.formatDate(course.startDate, 'DD.MM.YYYY') : undefined;
const untilDate = course.untilDate ? timesHelper.formatDate(course.untilDate, 'DD.MM.YYYY') : undefined;
const startDate = course.startDate
? timesHelper.formatDate(course.startDate, timesHelper.FORMAT.dateTime)
: undefined;
const untilDate = course.untilDate
? timesHelper.formatDate(course.untilDate, timesHelper.FORMAT.dateTime)
: undefined;

const selectedElements = {
teachersSelected: selectedElementIdsToString(markSelected(teachers, course.teacherIds)),
Expand Down Expand Up @@ -842,8 +846,8 @@ router.patch('/:courseId', async (req, res, next) => {
const keys = ['teacherIds', 'substitutionIds', 'classIds', 'userIds'];
req.body = strToPropsArray(req.body, keys);

const startDate = timesHelper.dateStringToMoment(req.body.startDate);
const untilDate = timesHelper.dateStringToMoment(req.body.untilDate);
const startDate = timesHelper.dateTimeStringToMoment(req.body.startDate).utc();
const untilDate = timesHelper.dateTimeStringToMoment(req.body.untilDate).utc();

delete req.body.startDate;
if (startDate.isValid()) {
Expand Down

0 comments on commit 50011a4

Please sign in to comment.