|
4 | 4 | const url = require("url");
|
5 | 5 | const axios = require("axios");
|
6 | 6 | const _ = require("lodash");
|
7 |
| -const moment = require("moment"); |
| 7 | +const moment = require("moment-timezone"); |
8 | 8 | const fs = require("fs");
|
9 | 9 |
|
10 | 10 | // eslint-disable-next-line
|
@@ -34,14 +34,16 @@ async function getInterviewThankYouPageController(req, res) {
|
34 | 34 | const { data: timeslots } = await axios.get(
|
35 | 35 | `https://api.schedule.nylas.com/schedule/${query.page_slug}/timeslots?locale=en`
|
36 | 36 | );
|
| 37 | + const startTime = moment.unix(query.start_time).tz(query.tz); |
| 38 | + const endTime = moment.unix(query.end_time).tz(query.tz); |
37 | 39 | const object = {
|
38 | 40 | jobTitle: nylasconfig.name,
|
39 | 41 | calendarName: _.get(timeslots, "[0].host_name", ""),
|
40 | 42 | tz: query.tz,
|
41 |
| - week: moment.unix(query.start_time).format("dddd"), |
42 |
| - startDate: moment.unix(query.start_time).format("MMMM DD, yyyy"), |
43 |
| - startTime: moment.unix(query.start_time).format("H:mm A"), |
44 |
| - endTime: moment.unix(query.end_time).format("H:mm A"), |
| 43 | + week: startTime.format("dddd"), |
| 44 | + startDate: startTime.format("MMMM DD, yyyy"), |
| 45 | + startTime: startTime.format("H:mm A"), |
| 46 | + endTime: endTime.format("H:mm A"), |
45 | 47 | };
|
46 | 48 |
|
47 | 49 | res.set("Content-Type", "text/html");
|
|
0 commit comments