mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Return calendar events for the current day (not just ones after now())
This commit is contained in:
parent
71b0500c6f
commit
1e7af63e63
@ -114,7 +114,7 @@ func Fetch() *calendar.Events {
|
||||
log.Fatalf("Unable to retrieve calendar Client %v", err)
|
||||
}
|
||||
|
||||
t := time.Now().Format(time.RFC3339)
|
||||
t := today().Format(time.RFC3339)
|
||||
events, err := srv.Events.List("primary").ShowDeleted(false).
|
||||
SingleEvents(true).TimeMin(t).MaxResults(10).OrderBy("startTime").Do()
|
||||
if err != nil {
|
||||
@ -123,3 +123,8 @@ func Fetch() *calendar.Events {
|
||||
|
||||
return events
|
||||
}
|
||||
|
||||
func today() time.Time {
|
||||
now := time.Now()
|
||||
return time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user