Skip to content

Commit

Permalink
Retorna todos os eventos dos próximos 365 dias
Browse files Browse the repository at this point in the history
Script original de consulta ao Google Calendar retornava todos os
eventos dos próximos 30 dias, mas com a virada de ano ficaríamos mais
de 30 dias sem eventos do Sanca Hub, resultando em layout quebrado
  • Loading branch information
Thiago Christof committed Dec 14, 2012
1 parent 28d46d4 commit 54d6711
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions _gcal.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
$right_now = date("Y-m-d\Th:i:sP", time());

// For our purposes, a month will be 30 days
$month_in_seconds = 60 * 60 * 24 * 30;
$next_month = date("Y-m-d\Th:i:sP", time() + $month_in_seconds);
//$month_in_seconds = 60 * 60 * 24 * 30;
//$next_month = date("Y-m-d\Th:i:sP", time() + $month_in_seconds);

// For sancahub.com.br purposes
$year_in_seconds = 60 * 60 * 24 * 365;
$next_year = date("Y-m-d\Th:i:sP", time() + $year_in_seconds);

// This is my version of the call to Google's API. See
// http://code.google.com/apis/calendar/data/2.0/reference.html#Parameters
Expand All @@ -40,7 +44,7 @@
"public/full?orderby=starttime&singleevents=true&" .
"sortorder=ascending&" .
"start-min=" . $right_now . "&" .
"start-max=" . $next_month;
"start-max=" . $next_year;

// Create a new document from the feed
$doc = new DOMDocument();
Expand Down

0 comments on commit 54d6711

Please sign in to comment.