File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ const (
2828 WeekDaysNotPresent ErrorMessage = "weekdays, must be present for Weekly frequency"
2929 WeekDayFromOrToNotPresent ErrorMessage = "weekdayFrom, must be present for WeeklyRange frequency"
3030 DayFromOrToNotPresent ErrorMessage = "dayFrom, dayTo, must be present for Monthly frequency"
31- ToBeforeFrom ErrorMessage = "Invalid value of hourMinuteFrom or hourMinuteTo for same day ,hourMinuteFrom >hourMinuteTo"
31+ ToBeforeFrom ErrorMessage = "Invalid value of hourMinuteFrom or hourMinuteTo for same day ,hourMinuteFrom > hourMinuteTo"
3232 BothLessThanZeroAndFromGreaterThanTo ErrorMessage = "invalid value of DayFrom or DayTo,DayFrom and DayTo is less than zero and dayFrom > dayTo"
3333 DayFromOrToNotValid ErrorMessage = "invalid value of dayFrom or dayTo"
3434 InvalidHourMinuteForWeeklyAndDaily ErrorMessage = "HourMinuteFrom should be less than HourMinuteTo in daily or weekly Frequency"
Original file line number Diff line number Diff line change @@ -86,6 +86,11 @@ func (tr TimeRange) ValidateTimeRange() error {
8686 if (tr .WeekdayFrom < 0 || tr .WeekdayFrom > 6 ) || (tr .WeekdayTo < 0 || tr .WeekdayTo > 6 ) {
8787 return errors .New (string (WeekDayOutsideRange ))
8888 }
89+ // Same weekday with a non-positive intra-day span collapses the window to zero/negative
90+ // duration, which stalls the next-window search. Reject it (mirrors the Monthly check).
91+ if tr .WeekdayFrom == tr .WeekdayTo && isToBeforeFrom (tr .HourMinuteFrom , tr .HourMinuteTo ) {
92+ return errors .New (string (ToBeforeFrom ))
93+ }
8994 case Monthly :
9095 if tr .DayFrom == 0 || tr .DayTo == 0 {
9196 return errors .New (string (DayFromOrToNotPresent ))
You can’t perform that action at this time.
0 commit comments