i have an app to create and schedule meetings with zoom and this is how it works
In React i send data as start_time: dateTime.toISOString()
.
I have logged Request and Response from both client and API:
for time 2019-09-25 04:00PM GMT +5:30 (IST)
start_time: '2021-09-25T10:30:00.000Z'
start_time:"2021-09-25T09:41:58Z"
when converted in client side new Date(start_time)
returns the current time at which i created the request.
for time 2019-09-26 05:30PM GMT +5:30 (IST)
start_time: '2021-09-25T12:00:00.000Z'
start_time:"2021-09-26T06:30:12Z"
when converted to date produces Time 12:00PM
.
I create meetings with zoom APi like so and after receiving API Response i store response data to Mongo DB:
axios(config)
.then(function (response) {
response.data["participants"] = participants;
const newMeeting = new Meeting(response.data);
try {
newMeeting
.save()
.exec()
.then((meeting) => {
console.log("Successfully store meeting to database");
});
} catch (err) {
console.error(err);
}
res.json(response.data);
})
.catch(function (err) {
console.error(err);
});
how could i tackle this issue?
I also faced same problem.
It was due to difference in local time and UTC time.
This is how I managed to resolve this issue.
Created UTC dateTime String in this format 04/04/2022 07:48:27 PM UTC using moment.js and used that formated String UTCDateTime in javascript Date Object. Code Example givin below It may help you.
var UTCDateTime=moment(dateTime).format("MM/DD/YYYY hh:mm:ss A UTC");
var meetingTime = new Date(UTCDateTime);
Used meetingTime for meeting start_time and it worked for me.
start_time : meetingTime