I have function where I convert local time to UTC time, it works fine locally but when i deploy app on aws, it is no longer working
import timezone from "geo-tz";
import moment from "moment-timezone";
const { find } = timezone;
function convertToUtc(time, lon, lat) {
const timezone = find(lat, lon);
const date = moment(time, "HHmm").tz(timezone[0]).utc().format("HH:mm");
return date;
}
export default convertToUtc;
and this is where I use this module
const user = await User.find({ chatID: res.chat.id });
const utctime = utc(
user[0].time,
res.location.longitude,
res.location.latitude
);
await User.find({ chatID: res.chat.id }).update({
time: utctime,
location: res.location,
});