blocks controller improved to find blocks by date

This commit is contained in:
Mario Colque 2014-01-09 15:15:30 -03:00
parent 100b901581
commit aa771bf4dd

View File

@ -51,7 +51,13 @@ exports.list = function(req, res) {
var findParam = {}; var findParam = {};
if (req.query.blockDate) { if (req.query.blockDate) {
findParam = {}; var gte = Math.round((new Date(req.query.blockDate)).getTime() / 1000);
var lte = gte + 86400;
findParam = { time: {
'$gte': gte,
'$lte': lte
}};
} }
Block Block
@ -67,3 +73,14 @@ exports.list = function(req, res) {
} }
}); });
}; };
1296688602
1296615600
1296615600000