diff --git a/server/i18n/en.json b/server/i18n/en.json index e14eab0..012723c 100644 --- a/server/i18n/en.json +++ b/server/i18n/en.json @@ -379,6 +379,10 @@ "id": "minute", "translation": "minute" }, + { + "id": "mins", + "translation": "mins" + }, { "id": "min", "translation": "min" diff --git a/server/occurrence.go b/server/occurrence.go index 531f6eb..feb3a90 100755 --- a/server/occurrence.go +++ b/server/occurrence.go @@ -430,6 +430,7 @@ func (p *Plugin) inEN(when string, user *model.User) (times []time.Time, err err case T("minutes"), T("minute"), + T("mins"), T("min"): i, e := strconv.Atoi(value) @@ -1046,18 +1047,22 @@ func (p *Plugin) freeFormEN(when string, user *model.User) (times []time.Time, e whenTrim := strings.Trim(when, " ") chronoUnit := strings.ToLower(whenTrim) - dateTimeSplit := strings.Split(chronoUnit, " "+T("at")+" ") chronoTime := "9:00AM" - chronoDate := dateTimeSplit[0] + chronoDate := chronoUnit - if len(dateTimeSplit) > 1 { - chronoTime = dateTimeSplit[1] + if strings.Contains(chronoUnit, T("at")) { + dateTimeSplit := strings.Split(chronoUnit, " "+T("at")+" ") + chronoDate = dateTimeSplit[0] + if len(dateTimeSplit) > 1 { + chronoTime = dateTimeSplit[1] + } } else { - _, ntErr := p.normalizeTime(dateTimeSplit[0], user) + _, ntErr := p.normalizeTime(chronoDate, user) if ntErr == nil { - return p.at(T("at")+" "+dateTimeSplit[0], user) + return p.at(T("at")+" "+chronoDate, user) } } + dateUnit, ndErr := p.normalizeDate(chronoDate, user) if ndErr != nil { return []time.Time{}, ndErr diff --git a/server/parse.go b/server/parse.go index 3786926..dc077f5 100755 --- a/server/parse.go +++ b/server/parse.go @@ -49,7 +49,7 @@ func (p *Plugin) ParseRequest(request *ReminderRequest) error { return wErr } - toIndex := strings.Index(request.Reminder.When, T("to")) + toIndex := strings.Index(request.Reminder.When, T("to")+" ") if toIndex > -1 { request.Reminder.When = request.Reminder.When[0:toIndex] }