todo-server/server/ajax/form/cron.go

20 lines
317 B
Go

package form
import (
"log"
"time"
"github.com/robfig/cron/v3"
)
type Cron string
func (c Cron) Next(since time.Time) time.Time {
schedule, err := cron.ParseStandard(string(c))
if err != nil {
log.Printf("failed to parse cron %q: %v", string(c), err)
return time.Time{}
}
return schedule.Next(since)
}