Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Google Calendar Lower Bounds for Start Time

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there it's my first time using an API. I'm having a little trouble with the google calendar api. What i have is after a event gets printed out it gets the next event



The above is code to get the next event. But my problem is this:



The problem is when i run it, it says the next event is "example event". For me the next event should be "2nd event" because the start time of "example event" has already passed.

In the api there is a timeMax:


Timemax is the upper bounds of the start time. But what I really need is the lower bounds of the start time and the api doesn't have that.

Link to full list of parameters in the api: https://developers.google.com/google-apps/calendar/v3/reference/events/list

If my start time is [lower bounds, upper bounds] I want [the time now, upperbounds]

I guess a possible solution would be to get not just the "next event" but get like the "next 10 events". Then have a comparater to check if the event's start time (which i can get after i retrieve the events) is less than the current time.

If not get the "next event"

I'm just thinking worst case if all 10 events start before the start time and the 11th event starts after then the 11th event wouldn't get retrieved.

I'd have to use the list method with a query of 20 and repeat to get the "next 20 events" and perhaps have a counter on the last position (10).

I might also need to have an event in like 2050 or something so there will also be an event in the future.

Is that the best solution for this?
 
Loren Agular
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm just going to try my solution.
I'll post how it goes here later.
I can always just convert to a diff solution later as well.
 
Loren Agular
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My solution works.
Might not be the best solution, but gets the job done.
Set the range to 20 and filter for what i want.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic