diff --git a/plugin.json b/plugin.json index 563d121..a37d98e 100755 --- a/plugin.json +++ b/plugin.json @@ -2,7 +2,7 @@ "id": "com.github.scottleedavis.mattermost-plugin-remind", "name": "Remind Bot Mattermost Plugin", "description": "Sets Reminders", - "version": "0.1.7", + "version": "0.1.8", "server": { "executables": { "linux-amd64": "server/dist/plugin-linux-amd64", diff --git a/server/manifest.go b/server/manifest.go index 536e10c..bee8deb 100755 --- a/server/manifest.go +++ b/server/manifest.go @@ -5,5 +5,5 @@ var manifest = struct { Version string }{ Id: "com.github.scottleedavis.mattermost-plugin-remind", - Version: "0.1.7", + Version: "0.1.8", } diff --git a/server/occurrence.go b/server/occurrence.go index 430f190..531f6eb 100755 --- a/server/occurrence.go +++ b/server/occurrence.go @@ -628,7 +628,6 @@ func (p *Plugin) atEN(when string, user *model.User) (times []time.Time, err err now := time.Now().In(location).Round(time.Hour * time.Duration(24)) occurrence := t.AddDate(now.Year(), int(now.Month())-1, now.Day()-1) - return []time.Time{p.chooseClosest(user, &occurrence, true).UTC()}, nil } diff --git a/server/utils.go b/server/utils.go index f992f0e..ff03ffb 100755 --- a/server/utils.go +++ b/server/utils.go @@ -20,18 +20,23 @@ func (p *Plugin) translation(user *model.User) (i18n.TranslateFunc, string) { } func (p *Plugin) location(user *model.User) *time.Location { - tz_code := user.GetPreferredTimezone() - if tz_code == "" { - tz_code, _ = time.Now().Zone() - } - if tzLoc, err := timezone.GetTimezones(tz_code); err != nil { - return time.Now().Location() - } else { - if l, lErr := time.LoadLocation(tzLoc[0]); lErr != nil { + tz := user.GetPreferredTimezone() + if tz == "" { + tzCode, _ := time.Now().Zone() + + if tzLoc, err := timezone.GetTimezones(tzCode); err != nil { return time.Now().Location() } else { - return l - } + if l, lErr := time.LoadLocation(tzLoc[0]); lErr != nil { + return time.Now().Location() + } else { + return l + } + } + } else { + location, _ := time.LoadLocation(tz) + return location } + }