diff --git a/server/occurrence.go b/server/occurrence.go index b4eb4f7..e18237a 100755 --- a/server/occurrence.go +++ b/server/occurrence.go @@ -624,7 +624,10 @@ func (p *Plugin) atEN(when string, user *model.User) (times []time.Time, err err if len(normalizedWhen) == 3 { s = normalizedWhen[:len(normalizedWhen)-2] s2 = normalizedWhen[len(normalizedWhen)-2:] - } else if len(normalizedWhen) >= 4 { + } else if len(normalizedWhen) == 4 { + s = normalizedWhen[:len(normalizedWhen)-2] + s2 = normalizedWhen[len(normalizedWhen)-2:] + } else if len(normalizedWhen) > 4 { s = normalizedWhen[:len(normalizedWhen)-4] s2 = normalizedWhen[len(normalizedWhen)-4:] } @@ -935,7 +938,7 @@ func (p *Plugin) everyEN(when string, user *model.User) (times []time.Time, err chronoTime = strings.Trim(dateTimeSplit[1], " ") } - if chronoDate == T("weekday") || chronoDate == T("weekdays") { + if chronoDate == T("weekday") || chronoDate == T("weekdaysgh") { chronoDate = T("monday") + "," + T("tuesday") + "," + T("wednesday") + "," + T("thursday") + "," + T("friday") } days := p.regSplit(chronoDate, "("+T("and")+")|(,)") diff --git a/server/occurrence_test.go b/server/occurrence_test.go index acb2b37..7fabf5c 100755 --- a/server/occurrence_test.go +++ b/server/occurrence_test.go @@ -187,6 +187,7 @@ func TestAt(t *testing.T) { api := &plugintest.API{} api.On("LogDebug", mock.Anything, mock.Anything, mock.Anything).Maybe() api.On("LogInfo", mock.Anything).Maybe() + api.On("LogError", mock.Anything).Maybe() return api } @@ -260,6 +261,10 @@ func TestAt(t *testing.T) { assert.Nil(t, err) assert.True(t, times[0].In(location).Hour() == 17 && times[0].In(location).Minute() == 0) + times, err = p.atEN("at 10PM", user) + assert.Nil(t, err) + assert.True(t, times[0].In(location).Hour() == 22 && times[0].In(location).Minute() == 0) + times, err = p.atEN("at 4 am", user) assert.Nil(t, err) assert.True(t, times[0].In(location).Hour() == 4 && times[0].In(location).Minute() == 0)