Filtering by a date range
joonipea opened this issue · 1 comments
joonipea commented
Hi I'm working on adding a slick carousel to instafeed for the past two weeks posts which I got working pretty easily. The problem I'm running into is filtering the feed by a date range. I followed the instructions in #152 but it doesn't seem to work as is.
For reference here's my initialization script.
accessToken: InstagramToken,
resolution: 'standard_resolution',
sortBy: 'most-recent',
limit: 12,
links: false,
template: '{{ instafeed_template }}',
filter: function(image) {
var odate = []
var ndate = []
var d = new Date();
var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var month = months[d.getMonth()]; //months from 1-12
var day = d.getDate();
var tweek = d.getDate() - 14;
var year = d.getFullYear();
newdate = "'" + month + " " + day + " " + year + "'";
olddate = month + " " + tweek + " " + year;
odate.push(olddate);
ndate.push(newdate);
var minDate = (new Date(odate)).getTime();
var maxDate = (new Date(ndate)).getTime();
var imageDate = parseInt(image.created_time, 10);
return imageDate >= minDate && imageDate <= maxDate;
},
after: function () {
$('.single-item').slick({
'dots': true,
'arrows': false,
'respondTo': 'min',
'dotsClass': 'qv-dots',
'useTransform': false
}).css('opacity', '1');
}
});
feed.run();
stale commented
This issue has been automatically marked as stale because it hasn't had new comments in the last 3 months. It will be closed if no further activity occurs. If you still need assistance with this issue, or believe it shouldn't be closed, please respond with a new comment to let us know.
Thank you all for your contributions.