Added handling for day-of-week spans that end in seven
This commit is contained in:
parent
da0523faa4
commit
b2b968fa7d
|
@ -317,6 +317,10 @@ func (expr *Expression) dowFieldHandler(s string) error {
|
||||||
case one:
|
case one:
|
||||||
populateOne(expr.daysOfWeek, directive.first)
|
populateOne(expr.daysOfWeek, directive.first)
|
||||||
case span:
|
case span:
|
||||||
|
// To properly handle spans that end in 7 (Sunday)
|
||||||
|
if directive.last == 0 {
|
||||||
|
directive.last = 6
|
||||||
|
}
|
||||||
populateMany(expr.daysOfWeek, directive.first, directive.last, directive.step)
|
populateMany(expr.daysOfWeek, directive.first, directive.last, directive.step)
|
||||||
case all:
|
case all:
|
||||||
populateMany(expr.daysOfWeek, directive.first, directive.last, directive.step)
|
populateMany(expr.daysOfWeek, directive.first, directive.last, directive.step)
|
||||||
|
|
|
@ -141,6 +141,15 @@ var crontests = []crontest{
|
||||||
{"2013-12-30 00:30:00", "Sat 2014-01-04 00:00"},
|
{"2013-12-30 00:30:00", "Sat 2014-01-04 00:00"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"0 0 * * 5-7",
|
||||||
|
"Mon 2006-01-02 15:04",
|
||||||
|
[]crontimes{
|
||||||
|
{"2013-01-01 00:00:00", "Fri 2013-01-04 00:00"},
|
||||||
|
{"2013-01-28 00:00:00", "Fri 2013-02-01 00:00"},
|
||||||
|
{"2013-12-30 00:30:00", "Fri 2014-01-03 00:00"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
// Specific days of week
|
// Specific days of week
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue