#6: added simple test to avoid work
This commit is contained in:
parent
2fc5c1e285
commit
0e96f12377
|
@ -183,7 +183,14 @@ func (expr *Expression) calculateActualDaysOfMonth(year, month int) []int {
|
||||||
// "fields - day of month, and day of week. If both fields are
|
// "fields - day of month, and day of week. If both fields are
|
||||||
// "restricted (ie, aren't *), the command will be run when
|
// "restricted (ie, aren't *), the command will be run when
|
||||||
// "either field matches the current time"
|
// "either field matches the current time"
|
||||||
if expr.daysOfMonthRestricted || expr.daysOfWeekRestricted == false {
|
|
||||||
|
// If both fields are not restricted, all days of the month are a hit
|
||||||
|
if expr.daysOfMonthRestricted == false && expr.daysOfWeekRestricted == false {
|
||||||
|
return genericDefaultList[1 : lastDayOfMonth.Day()+1]
|
||||||
|
}
|
||||||
|
|
||||||
|
// day-of-month != `*`
|
||||||
|
if expr.daysOfMonthRestricted {
|
||||||
// Last day of month
|
// Last day of month
|
||||||
if expr.lastDayOfMonth {
|
if expr.lastDayOfMonth {
|
||||||
actualDaysOfMonthMap[lastDayOfMonth.Day()] = true
|
actualDaysOfMonthMap[lastDayOfMonth.Day()] = true
|
||||||
|
@ -209,6 +216,7 @@ func (expr *Expression) calculateActualDaysOfMonth(year, month int) []int {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// day-of-week != `*`
|
||||||
if expr.daysOfWeekRestricted {
|
if expr.daysOfWeekRestricted {
|
||||||
// How far first sunday is from first day of month
|
// How far first sunday is from first day of month
|
||||||
offset := 7 - int(firstDayOfMonth.Weekday())
|
offset := 7 - int(firstDayOfMonth.Weekday())
|
||||||
|
|
Loading…
Reference in New Issue