The short answer is that when this script is run after 6 pm,
the SchEnd becomes a date for the following day with a time earlier
than the starttime (SchStart) . Since this is a daily task, it
cannot span multiple days nor can it have an end time earlier than
the start time.
If you were to make sure that the enddate was the same as the
startdate and that the end time was no more than 23:59, it will
work.