Reputation: 2544
I have user inputs of meeting_time
which is javascript Date (calendar select) and meeting_time
string (select dropdown option)
var userTime = meeting_time ? meeting_time.label.split(' -')[0] : null
var userDate = moment(meeting_date).format("YYYY-MM-DD");
How Do I converting those variable to moment.js object with specific timezone
For example,
meeting_date
is Thu Jul 12 2018 12:00:00 GMT+0300 (MSK)meeting_time
is 15:00 - 15:30I want to get moment _d
Thu Jul 12 2018 20:00:00 GMT+0800 (UTC +3 to UTC +8)
Upvotes: 0
Views: 51
Reputation: 5041
You can set the hour and minute in the date.
const [hour, minute] = userTime.split(':');
moment(meeting_date).hour(hour).minute(minute).toDate();
Upvotes: 1