When Christmas and/or Boxing Day falls on a weekend, it is rolled
            forward to the next weekday.
337183
def shift_christmas_boxing_days(self, year):
        
        christmas = date(year, 12, 25)
        boxing_day = date(year, 12, 26)
        boxing_day_label = "{} Shift".format(self.boxing_day_label)
        results = []
        if christmas.weekday() in self.get_weekend_days():
            shift = self.find_following_working_day(christmas)
            results.append((shift, "Christmas Shift"))
            results.append((shift + timedelta(days=1), boxing_day_label))
        elif boxing_day.weekday() in self.get_weekend_days():
            shift = self.find_following_working_day(boxing_day)
            results.append((shift, boxing_day_label))
        return results
1070589
def next_monday_or_tuesday(dt):
    
    dow = dt.weekday()
    if dow == 5 or dow == 6:
        return dt + timedelta(2)
    elif dow == 0:
        return dt + timedelta(1)
    return dt
1095117
def byweekday(self):
        
        retval = []
        if self.rule._byweekday:
            retval += [Weekday(day) for day in self.rule._byweekday]
        if self.rule._bynweekday:
            retval += [Weekday(day, n) for day, n in self.rule._bynweekday]
        return retval
237264
def weekday_to_str(
    weekday: Union[int, str], *, inverse: bool = False
) -> Union[int, str]:
    
    s = [
        "monday",
        "tuesday",
        "wednesday",
        "thursday",
        "friday",
        "saturday",
        "sunday",
    ]
    if not inverse:
        try:
            return s[weekday]
        except:
            return
    else:
        try:
            return s.index(weekday)
        except:
            return
781231
def previous_week_day(base_date, weekday):
    
    day = base_date - timedelta(days=1)
    while day.weekday() != weekday:
        day = day - timedelta(days=1)
    return day
495956
function(opts, day, abbr)
    {
        day += opts.firstDay;
        while (day >= 7) {
            day -= 7;
        }
        return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day];
    }
1102195
function(count, includeWeekends) {
    initialize();

    count = count || 3;
    includeWeekends = includeWeekends || false;

    var self = this;
    var holidays = [];

    if (count > self.MAX_HOLIDAYS) {
      throw Error('Cannot request more than {MAX_HOLIDAYS} holidays at once.'.replace('{MAX HOLIDAYS}', self.MAX_HOLIDAYS));
    }

    /**
     * Collects holidays.
     */
    function collectHolidays() {
      if (typeof self.year.holidays[self.m] !== 'undefined' && typeof self.year.holidays[self.m] !== 'undefined') {
        self.year.holidays[self.m].forEach(function(holiday) {
          if (holidays.length < count && holiday.day >= self.d) {
            holidays.push(holiday);
          }
        });
      }
    }

    while (holidays.length < count) {
      if (!includeWeekends) {
        self.year.discardWeekends();
      }

      collectHolidays();

      if (holidays.length < count) {
        nextMonth();
      }
    }

    return holidays;
  }
622288
def get_next_holiday(self, division=None, date=None):
        
        date = date or datetime.date.today()
        for holiday in self.get_holidays(division=division):
            if holiday['date'] > date:
                return holiday
634896
private void setWeekDays(SortedSet<WeekDay> weekDays) {

        List<CmsCheckBox> checked = new ArrayList<CmsCheckBox>();

        for (WeekDay day : weekDays) {
            for (CmsCheckBox box : m_checkboxes) {
                if (box.getInternalValue().equals(day.toString())) {
                    checked.add(box);
                }
            }
        }
        for (CmsCheckBox box : m_checkboxes) {
            if (checked.contains(box)) {
                box.setChecked(true);
            } else {
                box.setChecked(false);
            }
        }

    }
638262
public function endOfWeek()
    {
        $dt = $this;
        if ($dt->dayOfWeek !== static::$weekEndsAt) {
            $dt = $dt->next(static::$weekEndsAt);
        }

        return $dt->endOfDay();
    }
1172754
private SortedSet<WeekDay> readWeekDays(JSONObject val) {

        try {
            JSONArray array = val.getJSONArray(JsonKey.PATTERN_WEEKDAYS);
            if (null != array) {
                SortedSet<WeekDay> result = new TreeSet<>();
                for (int i = 0; i < array.length(); i++) {
                    try {
                        result.add(WeekDay.valueOf(array.getString(i)));
                    } catch (JSONException | IllegalArgumentException e) {
                        LOG.error("Could not read weekday from JSON. Skipping that day.", e);
                    }
                }
                return result;
            }
        } catch (JSONException e) {
            LOG.debug("Could not read weekdays from JSON", e);
        }
        return new TreeSet<>();

    }
877820
private static BigDecimal daysPlusSeconds(BigInteger days, BigDecimal seconds) {
    return seconds.add(new BigDecimal(days.multiply(BigInteger.valueOf(24*60*60))));
  }
1131223
def rollforward(self, dt):
        
        if not self.onOffset(dt):
            if self.n >= 0:
                return self._next_opening_time(dt)
            else:
                return self._prev_opening_time(dt)
        return dt
626927
function(weekBeginDate) {
        var overlaps = false;
        var nextWeek = this.add(weekBeginDate, this.DAY, 6);
        if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
            overlaps = true;
        }
        return overlaps;
    }
79377
private void processCalendarDays(ProjectCalendar calendar, Record root)
   {
      // Retrieve working hours ...
      Record daysOfWeek = root.getChild("DaysOfWeek");
      if (daysOfWeek != null)
      {
         for (Record dayRecord : daysOfWeek.getChildren())
         {
            processCalendarHours(calendar, dayRecord);
         }
      }
   }
515228
def weekend_tomorrow(self, date_from=None, date_format=None):
		
		# date de demain que sur les jours de week-end
		return self.delta(days=1, date_from=date_from, date_format=date_format, days_range=[6, 7])
168280
function(year, includeWeekends) {
    initialize(year);

    includeWeekends = includeWeekends || false;

    var self = this;
    var holidays = [];

    if (!includeWeekends) {
      self.year.discardWeekends();
    }

    Object.keys(self.year.holidays).forEach(function(month) {
      self.year.holidays[month].forEach(function(holiday) {
        holidays.push(holiday);
      });
    });

    return holidays;
  }