filter paleo by 3 days
This commit is contained in:
parent
a2dd4b76ff
commit
43d658da71
2
paleo.js
2
paleo.js
@ -20,7 +20,7 @@ feeds.simple_test_feed = {
|
||||
"description": "Combined Paleo Feed",
|
||||
'site_url': 'http://pipes.silvrtree.co.uk/paleo.xml'
|
||||
},
|
||||
"plugins" : ['filter_last_week' ],
|
||||
"plugins" : ['filter_3_days' ],
|
||||
"sources": [
|
||||
{
|
||||
/* "name" : "JobServe",*/
|
||||
|
18
plugins/filter_3_days.js
Normal file
18
plugins/filter_3_days.js
Normal file
@ -0,0 +1,18 @@
|
||||
module.exports = function (item, itemOptions, source) {
|
||||
function inDays(d1, d2) {
|
||||
var t2 = d2.getTime();
|
||||
var t1 = d1.getTime();
|
||||
|
||||
return parseInt((t2-t1)/(24*3600*1000));
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
var then = new Date(itemOptions.date);
|
||||
|
||||
var d = inDays(then,now);
|
||||
|
||||
if (d < 3)
|
||||
return itemOptions;
|
||||
else
|
||||
return -1;
|
||||
};
|
Loading…
Reference in New Issue
Block a user