diff --git a/model/alarm.go b/model/alarm.go index d2f75e3..f9cc19b 100644 --- a/model/alarm.go +++ b/model/alarm.go @@ -109,7 +109,7 @@ func DropNextAlarm(cfg *config.Config, db *LevelDBStorage) error { return PutAlarmException(db, &AlarmException{ Start: &start, End: &stop, - Comment: fmt.Sprintf("Automatic exception to cancel recurrent alarm %s", next.Format("Mon at 15:05")), + Comment: fmt.Sprintf("Automatic exception to cancel recurrent alarm %s", next.Format("Mon at 15:04")), }) } } @@ -167,11 +167,11 @@ func (a *AlarmRepeated) FillExcepts(cfg *config.Config, db *LevelDBStorage) erro now := time.Now() for _, exception := range exceptions { - if now.After(time.Time(*exception.End)) { + end := time.Time(*exception.End).AddDate(0, 0, 1) + if now.After(end) { continue } - end := time.Time(*exception.End).AddDate(0, 0, 1) for t := time.Time(*exception.Start); end.After(t); t = t.AddDate(0, 0, 1) { if t.Weekday() == a.Weekday { a.Excepts = append(a.Excepts, time.Date(t.Year(), t.Month(), t.Day(), time.Time(*a.StartTime).Hour(), time.Time(*a.StartTime).Minute(), time.Time(*a.StartTime).Second(), 0, time.Local))