From fea7002e8859bf1eecc6ea37586a9d611f04671a Mon Sep 17 00:00:00 2001 From: rakeshSgr Date: Mon, 6 Dec 2021 17:37:43 +0530 Subject: [PATCH] session create and update time fixe --- services/helper/sessions.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/services/helper/sessions.js b/services/helper/sessions.js index 897f64747..8a975bec6 100644 --- a/services/helper/sessions.js +++ b/services/helper/sessions.js @@ -32,10 +32,18 @@ module.exports = class SessionsHelper { } if(bodyData.startDate){ - bodyData.startDate = moment.unix(bodyData.startDate).format() + bodyData.startDate = moment.unix(bodyData.startDate); + if(bodyData.timeZone){ + bodyData.startDate.tz(bodyData.timeZone); + } + bodyData.startDate = moment(bodyData.startDate).format(); } if(bodyData.endDate){ - bodyData.endDate = moment.unix(bodyData.endDate).format() + bodyData.endDate = moment.unix(bodyData.endDate); + if(bodyData.timeZone){ + bodyData.endDate.tz(bodyData.timeZone); + } + bodyData.endDate = moment(bodyData.endDate).format(); } let data = await sessionData.createSession(bodyData); @@ -67,10 +75,18 @@ module.exports = class SessionsHelper { if(bodyData.startDate){ - bodyData.startDate = moment.unix(bodyData.startDate).format() + bodyData.startDate = moment.unix(bodyData.startDate); + if(bodyData.timeZone){ + bodyData.startDate.tz(bodyData.timeZone); + } + bodyData.startDate = moment(bodyData.startDate).format(); } if(bodyData.endDate){ - bodyData.endDate = moment.unix(bodyData.endDate).format() + bodyData.endDate = moment.unix(bodyData.endDate); + if(bodyData.timeZone){ + bodyData.endDate.tz(bodyData.timeZone); + } + bodyData.endDate = moment(bodyData.endDate).format(); }