You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.
cronexpr.Parse() correctly parses dow (day-of-week) when written as 0-6 or SUN-SAT – but does NOT correctly parse when written as MON-SUN or 1-7
We can see that 0 and 7 both resolve to Sunday, so it should be possible to write expressions as either 0-6 OR 1-7 and have the same result. However- the 1-7 day-of-week does not parse.
Here is an example / reproduction scenario
package main
import (
"fmt"
"time"
"github.com/gorhill/cronexpr"
)
func main() {
t := time.Date(2017, time.July, 18, 13, 47, 0, 0, time.UTC)
for _, dow := range []string{"MON-SUN", "SUN-SAT", "0-6", "1-7"} {
times := cronexpr.MustParse(fmt.Sprintf("* * * * %s", dow)).NextN(t, 8)
if len(times) == 0 {
fmt.Printf("Could NOT parse [%s]\n", dow)
} else {
for i := range times {
fmt.Println(times[i].Format(time.RFC1123))
}
}
}
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
cronexpr.Parse() correctly parses dow (day-of-week) when written as
0-6
orSUN-SAT
– but does NOT correctly parse when written asMON-SUN
or1-7
We can see that
0
and7
both resolve toSunday
, so it should be possible to write expressions as either0-6
OR1-7
and have the same result. However- the1-7
day-of-week does not parse.Here is an example / reproduction scenario
The text was updated successfully, but these errors were encountered: