Skip to content

Commit

Permalink
Update agenda.js
Browse files Browse the repository at this point in the history
  • Loading branch information
harishsg99 authored Feb 27, 2021
1 parent a9a2c6e commit 6366c84
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions agenda.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
module.exports.scheduleMsg=scheduleMsg;

0 comments on commit 6366c84

Please sign in to comment.