From 2b7234ad1e1e46dfc1dcc28cc0febf64482ad1b7 Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Fri, 23 May 2025 11:04:20 +0530 Subject: [PATCH] changes --- src/controllers/installationController.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/controllers/installationController.js b/src/controllers/installationController.js index a0584c93..c8e06f1b 100644 --- a/src/controllers/installationController.js +++ b/src/controllers/installationController.js @@ -5345,6 +5345,7 @@ exports.particularCategory = async (req, reply) => { }; + exports.assignCategorizeIssue = async (request, reply) => { const { supportId } = request.params; const { support_teamMemberId, startDate, endDate, category, masterHardwareId } = request.body; @@ -5371,21 +5372,24 @@ exports.assignCategorizeIssue = async (request, reply) => { return reply.code(400).send({ error: 'Invalid startDate or endDate' }); } + // ✅ Format to "DD-MM-YYYY HH:mm:ss" + const formattedStart = moment(start).format("DD-MM-YYYY HH:mm:ss"); + const formattedEnd = moment(end).format("DD-MM-YYYY HH:mm:ss"); + let assignedCount = 0; support.categorizedIssues.forEach(issue => { - const issueDate = new Date(issue.movedAt); if ( issue.masterHardwareId === masterHardwareId && - issue.category === category + issue.category === category ) { issue.assignedTo = { name: teamMember.name, support_teamMemberId: teamMember.support_teamMemberId, phone: teamMember.phone, email: teamMember.email, - startDate: startDate, // Add startDate - endDate: endDate // Add endDate + startDate: formattedStart, // 👈 use formatted date + endDate: formattedEnd // 👈 use formatted date }; assignedCount++; }