From 4c0d5ed188aa2a1f4aac2cafcd8efa6a547dcb66 Mon Sep 17 00:00:00 2001 From: Vaibhav Date: Wed, 31 Jul 2019 11:58:58 -0400 Subject: [PATCH] fix timezone bug (#321) --- gateways/core/calendar/start.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gateways/core/calendar/start.go b/gateways/core/calendar/start.go index 8b389ad138..a90e088a8f 100644 --- a/gateways/core/calendar/start.go +++ b/gateways/core/calendar/start.go @@ -102,8 +102,9 @@ func (ese *CalendarEventSourceExecutor) listenEvents(cal *calSchedule, eventSour } lastT := time.Now() + var location *time.Location if cal.Timezone != "" { - location, err := time.LoadLocation(cal.Timezone) + location, err = time.LoadLocation(cal.Timezone) if err != nil { errorCh <- err return @@ -122,6 +123,9 @@ func (ese *CalendarEventSourceExecutor) listenEvents(cal *calSchedule, eventSour select { case tx := <-timer: lastT = tx + if location != nil { + lastT = lastT.In(location) + } response := &calResponse{ EventTime: tx, UserPayload: cal.UserPayload,