Skip to content

Commit

Permalink
Merge pull request #2124 from methodic-labs/develop
Browse files Browse the repository at this point in the history
2024-03-31 release
  • Loading branch information
UnsungHero97 committed Mar 31, 2024
2 parents 1f1be4a + a7d7d88 commit 5a2635e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/containers/tud/components/QuestionnaireForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ import {
getDateTimeFromData,
isFirstActivityPage,
selectPrimaryActivityByPage,
updateActivityDateAndDay
updateActivityDateAndDay,
updateDayEndTime,
} from '../utils';
import isIntroPage from '../utils/isIntroPage';
import isPreSurveyPage from '../utils/isPreSurveyPage';
Expand Down Expand Up @@ -352,6 +353,7 @@ const QuestionnaireForm = ({
}

updateActivityDateAndDay(formData, activityDay);
updateDayEndTime(formData);
updateSurveyProgress(formData);
};

Expand Down
12 changes: 11 additions & 1 deletion src/containers/tud/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { get, getIn } from 'immutable';
import { DataProcessingUtils } from 'lattice-fabricate';
import _get from 'lodash/get';
import _set from 'lodash/set';
import { DateTime } from 'luxon';

Expand Down Expand Up @@ -655,6 +656,14 @@ const updateActivityDateAndDay = (formData, activityDay) => {
_set(formData, [psk, ACTIVITY_DAY], activityDay);
};

const updateDayEndTime = (formData) => {
const psk = getPageSectionKey(DAY_SPAN_PAGE, 0);
const dayEndTime = _get(formData, [psk, DAY_END_TIME]);
if (typeof dayEndTime === 'string' && dayEndTime.startsWith('24:')) {
_set(formData, [psk, DAY_END_TIME], dayEndTime.replace('24:', '00:'));
}
};

export {
applyCustomValidation,
createFormSchema,
Expand All @@ -663,5 +672,6 @@ export {
formatTime,
getIs12HourFormatSelected,
selectPrimaryActivityByPage,
updateActivityDateAndDay
updateActivityDateAndDay,
updateDayEndTime,
};

0 comments on commit 5a2635e

Please sign in to comment.