Home > Back-end >  How can I control this code with "setInterval"?
How can I control this code with "setInterval"?

Time:02-24

I tried create a function for use that code in setInterval but when I create a function with that code it stop working. I tried almost everything. Could you guys help me about that?

(async () => {

  let feed = await parser.parseURL(url);


    
  feed.items.forEach(item => {
       const habert = item.pubDate;
       const d2 = new Date(habert)
     
       var diffMs = (d1 - d2);
       var diffHrs = Math.floor((diffMs % 86400000) / 3600000); // hours
       var diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); // minutes
       
       if(diffMins <= 5 && diffHrs <= 0){
            //console.log(`           
  • Related