【问题标题】:Google Calendar JSON not ordered by dateGoogle 日历 JSON 未按日期排序
【发布时间】:2012-01-24 22:40:02
【问题描述】:

我一直在尝试使用 Google Calendar JSON API,但遇到了一些问题。 我已经设法让它与 jQuery 一起工作,但由于某种原因,谷歌提供的 JSON 不是按日期排序的,而且似乎也遗漏了一些事件。

这是我正在使用的代码:

<script>
$.getJSON("http://www.google.com/calendar/feeds/weimar.org_cnijr5sa383f7kl28eu63996ec%40group.calendar.google.com/public/full?alt=json-in-script&max-results=25&singleevents=false&futureevents=true&sortorder=descending&callback=?",

function(json){

var html = '<ul id="event_feed">';

$.each(json.feed.entry,function(i,entry) {

html += '<li>' + $.format.date(entry['gd$when'][0].startTime + ' 00:00:00.000', "yyyy-MM-dd") + '</li>';

})

html += '</ul>';

$('#calendar').html(html);

});
</script>

如何解决这个问题?现在为了简单起见,我只是将每个事件的日期附加到一个 div 中。 format.date() 只是我用来重新格式化日期的插件。

【问题讨论】:

标签: jquery json api google-calendar-api


【解决方案1】:

试一试:

&orderby=starttime

【讨论】:

    猜你喜欢
    • 2018-01-25
    • 1970-01-01
    • 1970-01-01
    • 2014-06-10
    • 2021-01-08
    • 1970-01-01
    • 2011-02-19
    • 1970-01-01
    • 2012-11-09
    相关资源
    最近更新 更多