Skip to content

Commit

Permalink
Added time microdata element around dates
Browse files Browse the repository at this point in the history
  • Loading branch information
dhawalhshah committed Aug 19, 2011
1 parent e5756f4 commit 055ba81
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions js/controller.js
Expand Up @@ -124,15 +124,22 @@ var month=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct",

angular.filter('period',function(startDate,endDate){
startDateObj = new Date(startDate);
out = month[startDateObj.getMonth()] + ', ' + startDateObj.getFullYear() + ' - ';
startTimeEl = document.createElement("time");
startTimeEl.textContent = month[startDateObj.getMonth()] + ', ' + startDateObj.getFullYear();
startTimeEl.setAttribute("datetime", startDate);

this.$element.append( startTimeEl );
this.$element.append(document.createTextNode(" - ") );

if(endDate){
endDateObj = new Date(endDate);
out = out + month[endDateObj.getMonth()] + ', ' + endDateObj.getFullYear();
endTimeEl = document.createElement("time");
endTimeEl.textContent = month[endDateObj.getMonth()] + ', ' + endDateObj.getFullYear();
endTimeEl.setAttribute("datetime", endDate)
this.$element.append( endTimeEl );
}
else{
out = out + 'current';
}

return out;
this.$element.append(document.createTextNode("current"));
}
});

0 comments on commit 055ba81

Please sign in to comment.