From 8ca0ecef78c386db173686056dd5f83a9da6b8f2 Mon Sep 17 00:00:00 2001 From: Nicholas Eden Date: Wed, 3 Oct 2018 21:21:28 -0700 Subject: [PATCH] Display all day events in calendar, see #306 --- gcal/cal_event.go | 10 +++++++--- gcal/display.go | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gcal/cal_event.go b/gcal/cal_event.go index da96f072b8..81d2450c03 100644 --- a/gcal/cal_event.go +++ b/gcal/cal_event.go @@ -69,33 +69,37 @@ func (calEvent *CalEvent) ResponseFor(email string) string { func (calEvent *CalEvent) End() time.Time { var calcTime string + var end time.Time if calEvent.AllDay() { calcTime = calEvent.event.End.Date + end, _ = time.ParseInLocation("2006-01-02", calcTime, time.Local) } else { calcTime = calEvent.event.End.DateTime + end, _ = time.Parse(time.RFC3339, calcTime) } - end, _ := time.Parse(time.RFC3339, calcTime) return end } func (calEvent *CalEvent) Start() time.Time { var calcTime string + var start time.Time if calEvent.AllDay() { calcTime = calEvent.event.Start.Date + start, _ = time.ParseInLocation("2006-01-02", calcTime, time.Local) } else { calcTime = calEvent.event.Start.DateTime + start, _ = time.Parse(time.RFC3339, calcTime) } - start, _ := time.Parse(time.RFC3339, calcTime) return start } func (calEvent *CalEvent) Timestamp() string { if calEvent.AllDay() { - startTime, _ := time.Parse("2006-01-02", calEvent.event.Start.Date) + startTime, _ := time.ParseInLocation("2006-01-02", calEvent.event.Start.Date, time.Local) return startTime.Format(wtf.FriendlyDateFormat) } diff --git a/gcal/display.go b/gcal/display.go index 572eb67f19..88cad3b7f5 100644 --- a/gcal/display.go +++ b/gcal/display.go @@ -32,9 +32,8 @@ func (widget *Widget) display() { widget.mutex.Lock() defer widget.mutex.Unlock() - _, timedEvents := widget.sortedEvents() widget.View.SetTitle(widget.ContextualTitle(widget.Name)) - widget.View.SetText(widget.contentFrom(timedEvents)) + widget.View.SetText(widget.contentFrom(widget.calEvents)) } func (widget *Widget) contentFrom(calEvents []*CalEvent) string {