Dates handling.
Closed this issue · 2 comments
Yauda commented
Hi,
I'm currently using your library for rss and atom parsing. But i would like to get published AND updated dates in case of atom feed. I think both can be useful. What's your opinion?
https://github.com/andris9/NodePie/blob/master/lib/nodepie.js#L765-766
Your code is pretty clear, so maybe it'll be a problem of duplication code, but it could look like that :
NodePie.Item.prototype.getUpdateDate = function(){
var dcns = this.feed.namespaces[NodePie.NS.DC], date;
date = this.element.updated || this.element.modified || (dcns && this.element[dcns+":date"]) || false;
if(!date){
return false;
}
date = new Date(date);
if(!date.getFullYear()){
return false;
}
if(date.getTime() > Date.now()){
return new Date();
}
return date;
};
andris9 commented
yeah, thanks, it's a good idea - I'll add this to the project.