diff --git a/agenda.js b/agenda.js index b1ad45c..b569b84 100644 --- a/agenda.js +++ b/agenda.js @@ -4,22 +4,21 @@ const sentmail=require("./sendMail"); function scheduleMsg(start_url,time) { // Code for parsing date and time goes here - const temp=time.substring(0,time.length-1); - const temp2=temp.split('T'); - const datestr=temp2[0].split('-'); - const timestr=temp2[1].split(':'); - if(parseInt(timestr[2])>=30) - { - const date=new Date(parseInt(datestr[0]),parseInt(datestr[1]),parseInt(datestr[2]),parseInt(timestr[0]),parseInt(timestr[1])-5,parseInt(timestr[2])-30); - } - else - { - const date=new Date(parseInt(datestr[0]),parseInt(datestr[1]),parseInt(datestr[2]),parseInt(timestr[0]),parseInt(timestr[1])-6,60+(parseInt(timestr[2])-30)); - } - const job=schedule.scheduleJob(date,function() { + var temp=time.substring(0,time.length-1); + console.log(temp) + var temp2=temp.split('T'); + var datestr=temp2[0].split('-'); + var timestr=temp2[1].split(':'); + console.log(timestr) + const date=new Date(parseInt(datestr[0]),parseInt(datestr[1]),parseInt(datestr[2]),parseInt(timestr[0]),parseInt(timestr[1]),parseInt(timestr[2])); + console.log(date) + var date1 =date.toLocaleString("en-US", {timeZone: "Asia/Kolkata"}); + console.log(date1) + const job=schedule.scheduleJob(date1,function() { twilo.send(start_url); + console.log("Hey") sentmail.sendEmail(receiver_email,email_subject,email_body); }); } -module.exports.scheduleMsg = scheduleMsg; \ No newline at end of file +module.exports.scheduleMsg=scheduleMsg;