Skip to content

Commit

Permalink
fix the date logic and add formatting at end
Browse files Browse the repository at this point in the history
  • Loading branch information
JMStudiosJoe committed Apr 21, 2023
1 parent b070dde commit 4e7a8fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/compositions/Questionnaire/Questionnaire/Questionnaire.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ const Questionnaire = ({
const onSubmit = (e) => {
const { legal_resident_date } = questionnaireResponse;
if (legal_resident_date && legal_resident_date.valid) {
const { date } = legal_resident_date;
const formattedDate = `${date.getFullYear()}/${date.getMonth()}/${date.getDay()}`;
questionnaireResponse['legal_resident_date'] = formattedDate;
console.log('formatted date', formattedDate);
submitQuestionnaireResponse(questionnaireResponse);
} else {
alert(
Expand Down
4 changes: 1 addition & 3 deletions src/compositions/WorkshopScreening/Question3.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ const Question3 = ({
date,
valid: isEligable,
};
const formattedDate = `${dateObject.date.getFullYear()}/${dateObject.date.getMonth()}/${dateObject.date.getDay()} :: ${dateObject.date.getHours()}:${dateObject.date.getMinutes()}:${dateObject.date.getSeconds()}`;
console.log('formatted date', formattedDate);
collectAnswer(q.slug, formattedDate);
collectAnswer(q.slug, dateObject);
setShowModal(true);
}
};
Expand Down

0 comments on commit 4e7a8fe

Please sign in to comment.