diff --git a/struct_calendar.go b/struct_calendar.go index 1cd248e..8303089 100644 --- a/struct_calendar.go +++ b/struct_calendar.go @@ -78,6 +78,26 @@ func (c *Calendar) GetTodaysEvents() []Event { return ret } for _, e := range events.Items { + // Check if this event is an all-day event and, if so, is it actually today? + if _, err := time.Parse(time.RFC3339, e.Start.DateTime); err != nil { + tz := time.Now().Local().Format("-07:00") + stDt := e.Start.Date + "T00:00:00" + tz + stTm, err := time.Parse(time.RFC3339, stDt) + if err != nil { + continue + } + endDt := e.End.Date + "T00:00:00" + tz + endTm, err := time.Parse(time.RFC3339, endDt) + if err != nil { + continue + } + if stTm.After(maxTime) { + continue + } + if stTm.After(maxTime) || endTm.Before(minTime) { + continue + } + } ret = append(ret, *GoogleEventToLocalWithId(e, c.Id)) } return ret