From c452ca2fd078650131fc08eb0b9096abd50fee4a Mon Sep 17 00:00:00 2001 From: SodhiA1 <38086281+SodhiA1@users.noreply.github.com> Date: Wed, 11 Oct 2023 10:46:54 -0700 Subject: [PATCH] removed date formatter --- backend/src/components/edx/exchange.js | 9 +++------ .../src/components/secure-message/AccessUserCard.vue | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/backend/src/components/edx/exchange.js b/backend/src/components/edx/exchange.js index 8e5372148..36b81103a 100644 --- a/backend/src/components/edx/exchange.js +++ b/backend/src/components/edx/exchange.js @@ -497,7 +497,6 @@ async function checkIfPrimaryCodeExists(req,res, token, instituteType, institute async function districtUserActivationInvite(req, res) { const token = utils.getBackendToken(req); - const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss'); if (!token) { return res.status(HttpStatus.UNAUTHORIZED).json({ message: 'No access token' @@ -512,7 +511,7 @@ async function districtUserActivationInvite(req, res) { const payload = { ...req.body, - edxUserExpiryDate: req.body.edxUserExpiryDate ? LocalDate.parse(req.body.edxUserExpiryDate).atStartOfDay().format(formatter) : null + edxUserExpiryDate: req.body.edxUserExpiryDate }; try { const response = await utils.postData(token, config.get('server:edx:districtUserActivationInviteURL'), payload, null, utils.getUser(req).idir_username); @@ -555,7 +554,6 @@ async function updateEdxUserSchoolRoles(req, res) { try { const token = utils.getBackendToken(req); const userInfo = utils.getUser(req); - const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss'); let edxUser = await getData(token, `${config.get('server:edx:edxUsersURL')}/${req.body.params.edxUserID}`); let selectedUserSchools = edxUser.edxUserSchools.filter(school => school.schoolID === req.body.params.schoolID); @@ -584,7 +582,7 @@ async function updateEdxUserSchoolRoles(req, res) { selectedUserSchool.updateDate = null; selectedUserSchool.createDate = null; - selectedUserSchool.expiryDate = req.body.params.expiryDate ? LocalDate.parse(req.body.params.expiryDate).atStartOfDay().format(formatter) : null; + selectedUserSchool.expiryDate = req.body.params.expiryDate; const result = await utils.putData(token, `${config.get('server:edx:edxUsersURL')}/${selectedUserSchool.edxUserID}/school`, selectedUserSchool, userInfo.idir_username); return res.status(HttpStatus.OK).json(result); @@ -598,7 +596,6 @@ async function updateEdxUserDistrictRoles(req, res) { try { const token = utils.getBackendToken(req); const userInfo = utils.getUser(req); - const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss'); let edxUser = await getData(token, `${config.get('server:edx:edxUsersURL')}/${req.body.params.edxUserID}`); let selectedUserDistricts = edxUser.edxUserDistricts.filter(district => district.districtID === req.body.params.districtId); @@ -627,7 +624,7 @@ async function updateEdxUserDistrictRoles(req, res) { selectedUserDistrict.updateDate = null; selectedUserDistrict.createDate = null; - selectedUserDistrict.expiryDate = req.body.params.expiryDate ? LocalDate.parse(req.body.params.expiryDate).atStartOfDay().format(formatter) : null; + selectedUserDistrict.expiryDate = req.body.params.expiryDate; const result = await utils.putData(token, `${config.get('server:edx:edxUsersURL')}/${selectedUserDistrict.edxUserID}/district`, selectedUserDistrict, userInfo.idir_username); return res.status(HttpStatus.OK).json(result); diff --git a/frontend/src/components/secure-message/AccessUserCard.vue b/frontend/src/components/secure-message/AccessUserCard.vue index e3c5f4dee..ef0516c5a 100644 --- a/frontend/src/components/secure-message/AccessUserCard.vue +++ b/frontend/src/components/secure-message/AccessUserCard.vue @@ -154,6 +154,7 @@ id="accessExpiryDate" v-model="accessExpiryDate" label="Access Expiry Date" + model-type="yyyy-MM-dd'T'00:00:00" @clear-date="clearExpiryDate" /> @@ -479,7 +480,7 @@ export default { }); this.selectedRoles = [...mySelection]; - this.accessExpiryDate = this.formatExpiryDate(this.user.edxUserSchools[0].expiryDate); + this.accessExpiryDate = this.user.edxUserSchools[0].expiryDate; }, clearExpiryDate(){ this.accessExpiryDate = null;