开发者

Limit RSS Feed displayed by ZrssFeed by time

I'm using ZrssFeed to display an rss feed. I would like to limit it to only posts from the last 8 hours.

I tried adding the following block of code after ZRSS returns the feed:

// Add feeds
    for (var i=0; i<feeds.entries.length; i++) {

        // Get individual feed
        var entry = feeds.entries[i];
        feedcount = i;
        // Format published date
        var entryDate = new Date(entry.publishedDate);
        var pubDate = entryDate.toLocaleDateString() + ' ' + entryDate.toLocaleTimeString();
        var msPerDay = 8*60*60*1000;    // 8 hours
        var msPubDateTime = new Date(pubdate); // item date in ms
        if (msNow.g开发者_JAVA百科etTime() - entryDate.getTime() < msPerDay) //compare
                {



        // rest of plugin

This both doesn't work and seems to break the plugin altogether.


You may want to look at the jsDate script. It's great at handling all date-related JS issues.

http://www.datejs.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜