Fix 'All-Day' tomorrow bug
This commit is contained in:
parent
7800febdc5
commit
25f37688bb
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user