谷歌日历api start-min / start-max没有返回正确的值

时间:2011-02-09 00:15:14

标签: javascript json google-calendar-api

我正在查询google calendar api,以便在我提供的start-min和start-max日期之间恢复日期。但是,这样做,我得到的日期不应该被退回。我正在访问的日历在1月到2月之间有很多日期,但是它会在2010年返回日期,并且会在jan / feb之外返回日期。这是我的字符串

我用演示版替换了日历位置。这样做时,我使用我的公共日历链接

http://www.google.com/calendar/feeds/developer-calendar@google.com/public/full?alt=json&singleevents=true&sortorder=ascending&start-min2011-1-01T00:00:00%20&start-max2011-2-20T23:59:59

这是我回来的日期。

[INFO] starttime = 2010-01-09T00:00:00.000Z end time = 2010-01-09T02:00:00.000Z
[INFO] starttime = 2010-01-07T21:00:00.000Z end time = 2010-01-07T22:00:00.000Z
[INFO] starttime = 2010-01-12T00:30:00.000Z end time = 2010-01-12T02:30:00.000Z
[INFO] starttime = 2010-01-09T20:00:00.000Z end time = 2010-01-09T20:45:00.000Z
[INFO] starttime = 2010-01-16T20:00:00.000Z end time = 2010-01-16T21:30:00.000Z
[INFO] starttime = 2010-01-16T16:00:00.000Z end time = 2010-01-16T17:30:00.000Z
[INFO] starttime = 2010-01-14T00:30:00.000Z end time = 2010-01-14T01:15:00.000Z
[INFO] starttime = 2010-01-09T23:00:00.000Z end time = 2010-01-10T02:00:00.000Z
[INFO] starttime = 2010-01-16T21:00:00.000Z end time = 2010-01-16T22:00:00.000Z
[INFO] starttime = 2010-01-10T20:00:00.000Z end time = 2010-01-10T21:00:00.000Z
[INFO] starttime = 2010-01-14T22:00:00.000Z end time = 2010-01-14T23:00:00.000Z
[INFO] starttime = 2010-01-12T00:30:00.000Z end time = 2010-01-12T01:00:00.000Z
[INFO] starttime = 2010-01-11T16:30:00.000Z end time = 2010-01-11T17:00:00.000Z
[INFO] starttime = 2010-01-16T20:00:00.000Z end time = 2010-01-16T20:45:00.000Z
[INFO] starttime = 2010-01-12T16:00:00.000Z end time = 2010-01-12T16:30:00.000Z
[INFO] starttime = 2010-01-21T21:00:00.000Z end time = 2010-01-21T22:00:00.000Z
[INFO] starttime = 2010-04-22T20:30:00.000Z end time = 2010-04-22T21:15:00.000Z
[INFO] starttime = 2010-04-03T14:30:00.000Z end time = 2010-04-03T17:00:00.000Z
[INFO] starttime = 2010-03-25T20:00:00.000Z end time = 2010-03-25T22:00:00.000Z
[INFO] starttime = 2010-04-23T15:30:00.000Z end time = 2010-04-23T16:00:00.000Z
[INFO] starttime = 2010-02-03T22:00:00.000Z end time = 2010-02-03T23:00:00.000Z
[INFO] starttime = 2010-05-01T19:00:00.000Z end time = 2010-05-01T21:00:00.000Z
[INFO] starttime = 2010-02-13T23:00:00.000Z end time = 2010-02-14T02:00:00.000Z 
[INFO] starttime = 2010-04-30T21:00:00.000Z end time = 2010-04-30T22:30:00.000Z
[INFO] starttime = 2010-03-07T19:00:00.000Z end time = 2010-03-07T20:30:00.000Z

google api reference:http://code.google.com/apis/calendar/data/2.0/reference.html#Parameters

2 个答案:

答案 0 :(得分:2)

这里最大的问题似乎是你的GET语法。您有键和值,但没有赋值字符。换句话说,你需要等号。

此外,你需要领先0并删除那个讨厌的%20。

试试这个:

http://www.google.com/calendar/feeds/developer-calendar@google.com/public/full?alt=json&singleevents=true&sortorder=ascending&start-min=2011-01-01T00:00:00&start-max=2011-02-20T23:59:59

答案 1 :(得分:0)

在您发布的网址中,您已(摘录):

start-min2011-1-01T00:00:00%20&start-max2011-2-20T23:59:59

那应该是:

start-min=2011-01-01T00:00:00&start-max=2011-02-21T00:00:00

您缺少“=”字符,月份值应为2位数字。 “start-max”值是独占,这很方便,因为你不必那样做“23:59:59”;只需使用第二天的午夜。