var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://walkingdeadcomics.org/the-walking-dead-next-issue/', true);

xhr.onload = function () {
  var parser = new DOMParser();
  var doc = parser.parseFromString(this.responseText, 'text/html');

  var titleNode = doc.getElementById('p-title');
  var issueNumber = titleNode.innerText.substr(titleNode.innerText.indexOf('#')+1);
  var availabilityText = doc.querySelector('div.vision-contentbox-content.tt-content-style-black > span').innerText;
  var dateStart = availabilityText.substr(availabilityText.indexOf(':') + 1).trim();
  var array = dateStart.split(' ');
  var releaseDateString = array[0] + ' ' + array[1] + ' ' + array[2] + ' 09:00 GMT-0500';

  var releaseDate = new Date(releaseDateString);
  var wholeDaysUntilNextIssue = getDaysUntilDate(releaseDate);
  var issueCoverImageURL = generateIssueCoverURL(issueNumber);
  
  setComicVariablesInTasker(issueCoverImageURL, issueNumber, wholeDaysUntilNextIssue, releaseDateString);

  //signal to Tasker that the code is completed
  exit();
};

xhr.send();

function getDaysUntilDate(date) {
  var millisecondsUntilNextIssue = date - new Date();
  var days = millisecondsUntilNextIssue/1000/60/60/24;
  var wholeDaysUntilNextIssue = Math.floor(days);
  
  return wholeDaysUntilNextIssue;
}

function generateIssueCoverURL(issueNo) {
    if (issueNo.length === 1) {
	    issueNo = '0' + issueNo;
	}
	return ['http://i1.wp.com/walkingdeadcomics.org/wp-images/gallery/standard/', issueNo, '.jpg'].join('')
}

function setComicVariablesInTasker(issueCoverImageURL, issueNumber, wholeDaysUntilNextIssue, releaseDateString) {
  setLocalVariable('img',issueCoverImageURL);
  setLocalVariable('issueno',issueNumber);
  setLocalVariable('days',wholeDaysUntilNextIssue);
  setLocalVariable('date',releaseDateString);
}

function setLocalVariable(name, value, debug) {
    if (debug) {
        flash('setting ' + name + ' to ' + value);
	}
	setLocal(name, value);
};
@@ -639,24 +639,36 @@
 g = 
-array%5B0%5D + ' ' +
+getIssueDateString(array%5B0%5D,
  arr
@@ -676,16 +676,9 @@
 y%5B1%5D
- + ' ' +
+,
  arr
@@ -686,28 +686,9 @@
 y%5B2%5D
- + ' 09:00 GMT-0500'
+)
 ;%0A%0A 
@@ -1046,16 +1046,126 @@
 end();%0A%0A
+function getIssueDateString(month, day, year) %7B%0A    return %5Bmonth, day, year, '09:00 GMT-0500'%5D.join(' ');%0A%7D%0A%0A
 function

Refactor date retrieval logic