Advance to the next day that satisfies the byday rule...
169268
function byday(rules, dt, after) {
    if(!rules || !rules.length) return dt;

    // Generate a list of candiDATES. (HA!)
    var candidates = rules.map(function(rule) {
        // Align on the correct day of the week...
        var days = rule[1]-wkday(dt);
        if(days < 0) days += 7;
        var newdt = add_d(new Date(dt), days);

        if(rule[0] > 0) {
            var wk = 0 | ((d(newdt) - 1) / 7) + 1;
            if(wk > rule[0]) return null;

            add_d(newdt, (rule[0] - wk) * 7);
        }
        else if(rule[0] < 0) {
            // Find all the matching days in the month...
            var dt2 = new Date(newdt);
            var days = [];
            while(m(dt2) === m(newdt)) {
                days.push(d(dt2));
                add_d(dt2, 7);
            }

            // Then grab the nth from the end...
            set_d(newdt, days.reverse()[(-rule[0])-1]);
        }

        // Ignore if it's a past date...
        if (newdt.valueOf() <= after.valueOf()) return null;

        return newdt;
    });

    // Select the date occurring next...
    var newdt = sort_dates(candidates).shift();
    return newdt || dt;
}
700864
def advance(time)
      yes, no = @stack.partition { |rule| rule.include?(time) }

      if no.empty?
        yes.all? { |rule| rule.advance!(time) } or return false
        puts time if ENV["DEBUG"]
        yield time if block_given?
        true
      else
        no.any? { |rule| rule.continue?(time) }
      end
    end
659572
def advance(self):
        """"""
        self.cursor += 1
        if self.cursor >= len(self.raw):
            self.char = None
        else:
            self.char = self.raw[self.cursor]
793610
def get_next_weekday(self, including_today=False):
        
        weekday = self.date_time.weekday()
        return Weekday.get_next(weekday, including_today=including_today)
93889
def advance(self):
        
        try:
            return next(self._rules_iter)
        except InnerStopIteration:
            self._rules_iter = self._follow_rules()
            return StopIteration()
        except StopIteration:
            self._rules_iter = self._follow_rules()
            return final_rule
464146
protected function nextWeekly()
    {
        if (!$this->byHour && !$this->byDay) {
            $this->currentDate = $this->currentDate->modify('+'.$this->interval.' weeks');

            return;
        }

        if ($this->byHour) {
            $recurrenceHours = $this->getHours();
        }

        if ($this->byDay) {
            $recurrenceDays = $this->getDays();
        }

        // First day of the week:
        $firstDay = $this->dayMap[$this->weekStart];

        do {
            if ($this->byHour) {
                $this->currentDate = $this->currentDate->modify('+1 hours');
            } else {
                $this->currentDate = $this->currentDate->modify('+1 days');
            }

            // Current day of the week
            $currentDay = (int) $this->currentDate->format('w');

            // Current hour of the day
            $currentHour = (int) $this->currentDate->format('G');

            // We need to roll over to the next week
            if ($currentDay === $firstDay && (!$this->byHour || '0' == $currentHour)) {
                $this->currentDate = $this->currentDate->modify('+'.($this->interval - 1).' weeks');

                // We need to go to the first day of this week, but only if we
                // are not already on this first day of this week.
                if ($this->currentDate->format('w') != $firstDay) {
                    $this->currentDate = $this->currentDate->modify('last '.$this->dayNames[$this->dayMap[$this->weekStart]]);
                }
            }

            // We have a match
        } while (($this->byDay && !in_array($currentDay, $recurrenceDays)) || ($this->byHour && !in_array($currentHour, $recurrenceHours)));
    }
492405
def next_week_day(base_date, weekday):
    
    day_of_week = base_date.weekday()
    end_of_this_week = base_date + timedelta(days=6 - day_of_week)
    day = end_of_this_week + timedelta(days=1)
    while day.weekday() != weekday:
        day = day + timedelta(days=1)
    return day
92667
def next_bday(self):
        
        if self.n >= 0:
            nb_offset = 1
        else:
            nb_offset = -1
        if self._prefix.startswith('C'):
            # CustomBusinessHour
            return CustomBusinessDay(n=nb_offset,
                                     weekmask=self.weekmask,
                                     holidays=self.holidays,
                                     calendar=self.calendar)
        else:
            return BusinessDay(n=nb_offset)
113306
private void forward() {

        try {
            String macAddress = m_macAddress.getValue();
            String serverId = m_serverId.getValue();
            String serverUrl = m_serverUrl.getValue();
            CmsSetupBean setupBean = m_context.getSetupBean();
            setupBean.setEthernetAddress(macAddress);
            setupBean.setServerName(serverId);
            setupBean.setWorkplaceSite(serverUrl);
            setupBean.prepareStep8();
            m_context.stepForward();
        } catch (Exception e) {
            CmsSetupErrorDialog.showErrorDialog(e);

        }

    }
819748
protected function nextDaily()
    {
        if (!$this->byHour && !$this->byDay) {
            $this->currentDate = $this->currentDate->modify('+'.$this->interval.' days');

            return;
        }

        if (!empty($this->byHour)) {
            $recurrenceHours = $this->getHours();
        }

        if (!empty($this->byDay)) {
            $recurrenceDays = $this->getDays();
        }

        if (!empty($this->byMonth)) {
            $recurrenceMonths = $this->getMonths();
        }

        do {
            if ($this->byHour) {
                if ('23' == $this->currentDate->format('G')) {
                    // to obey the interval rule
                    $this->currentDate = $this->currentDate->modify('+'.($this->interval - 1).' days');
                }

                $this->currentDate = $this->currentDate->modify('+1 hours');
            } else {
                $this->currentDate = $this->currentDate->modify('+'.$this->interval.' days');
            }

            // Current month of the year
            $currentMonth = $this->currentDate->format('n');

            // Current day of the week
            $currentDay = $this->currentDate->format('w');

            // Current hour of the day
            $currentHour = $this->currentDate->format('G');
        } while (
            ($this->byDay && !in_array($currentDay, $recurrenceDays)) ||
            ($this->byHour && !in_array($currentHour, $recurrenceHours)) ||
            ($this->byMonth && !in_array($currentMonth, $recurrenceMonths))
        );
    }
578368
void advance() {
    if (tc.isEntryEnabled())
      tc.entry(this,cclass, "advance");
    if (!prefixDone) {
      Pattern.Clause prefix = pattern.getPrefix();
      if (prefix == null || next >= prefix.items.length) {
        Pattern.Clause suffix = pattern.getSuffix();
        if (suffix != null && suffix != prefix) {
          // SWITCH_TO_SUFFIX
          prefixDone = true;
          next = suffix.items.length-1;
        }
        // else in one of the FINAL_ states, so do nothing
      }
      else
        // somewhere in the body of the prefix, so advance by incrementing
        next++;
    }
    else
      // somewhere in the suffix, so advance by decrementing
      next--;
    if (tc.isEntryEnabled())
      tc.exit(this,cclass, "advance");
  }
1114001
def move_to(self, target_datetime):
        """"""
        target_datetime = _parse_time_to_freeze(target_datetime)
        delta = target_datetime - self.time_to_freeze
        self.tick(delta=delta)
606758
def add_business_days(date, delta)
      date = roll_forward(date)
      delta.times do
        begin
          date += day_interval_for(date)
        end until business_day?(date)
      end
      date
    end
814957
private function nextOrPreviousDay($weekday = true, $forward = true)
    {
        /** @var CarbonInterface $step */
        $date = $this;
        $step = $forward ? 1 : -1;

        do {
            $date = $date->addDays($step);
        } while ($weekday ? $date->isWeekend() : $date->isWeekday());

        return $date;
    }
234127
def goForward(self):
        
        if self._slideshow.currentIndex() == self._slideshow.count() - 1:
            self.finished.emit()
        else:
            self._slideshow.slideInNext()
787192
protected void progress(double pct, int blocksSoFar, Date date) {
        log.info(String.format(Locale.US, "Chain download %d%% done with %d blocks to go, block date %s", (int) pct, blocksSoFar,
                Utils.dateTimeFormat(date)));
    }
1312852
def next_tzolkin(tzolkin, jd):
    ''''''
    if jd < EPOCH:
        raise IndexError("Input day is before Mayan epoch.")

    count1 = _tzolkin_count(*to_tzolkin(jd))
    count2 = _tzolkin_count(*tzolkin)

    add_days = (count2 - count1) % 260
    return jd + add_days