Return Victoria Day for Edinburgh.

        Set to the Monday strictly before May 24th. It means that if May 24th
        is a Monday, it's shifted to the week before.
428463
def get_victoria_day(self, year):
        
        may_24th = date(year, 5, 24)
        # Since "MON(day) == 0", it's either the difference between MON and the
        # current weekday (starting at 0), or 7 days before the May 24th
        shift = may_24th.weekday() or 7
        victoria_day = may_24th - timedelta(days=shift)
        return (victoria_day, "Victoria Day")
44665
function isDayBefore(d1, d2) {
  var day1 = clone(d1).setHours(0, 0, 0, 0);
  var day2 = clone(d2).setHours(0, 0, 0, 0);
  return day1 < day2;
}
839500
public void setWholeDay(Boolean isWholeDay) {

        if (m_model.isWholeDay() ^ ((null != isWholeDay) && isWholeDay.booleanValue())) {
            m_model.setWholeDay(isWholeDay);
            valueChanged();
        }
    }
868416
public boolean isBefore(Day day)
  {
    if (day == null)
      throw new IllegalArgumentException("day cannot be null");

    return localDate.isBefore(day.localDate);
  }
1065352
def this_week():
        
        since = TODAY + delta(weekday=MONDAY(-1))
        until = since + delta(weeks=1)
        return Date(since), Date(until)
771159
def rollforward(self, date):
        """"""
        if self.onOffset(date):
            return date
        else:
            return date + QuarterEnd(month=self.month)
1320163
public void setShowWeekdayNames(boolean enable) {
        if(showWeekdayNames != enable) {
            showWeekdayNames = enable;
            // if FLAG_NUMBERS has been set, toggle the secondary text in the adapter
            if(showNumbersInView)
                setShowNumbersInViewInt(enable);
            // reselect the current item so it will use the new setting:
            setSelectedDate(getSelectedDate());
        }
    }
172680
function (week, today) {
		var now = new Date();
		if (today) {
			now.setDate(today);
		}
		week = 7 - (week || now.getDay());

		return new Date(now.getTime() + ONE_DAY_MILLISECONDS * week);
	}
462747
private void selectDefaultDate() {
        Calendar today = Calendar.getInstance();
        int hour = -1, minute = -1;

        // get the next possible selection
        Calendar date = getNextItemDate(today);
        // if it is the today item, we need to take a look the time
        if(date != null && DateSpinner.compareCalendarDates(date, today) == 0) {
            // same as getNextTimeDate for TimeSpinner
            final int last = timeSpinner.getLastItemPosition();
            final int searchHour = today.get(Calendar.HOUR_OF_DAY),
                    searchMinute = today.get(Calendar.MINUTE);
            for (int i=0; i<=last; i++) {
                final TimeItem time = ((TimeItem) timeSpinner.getItemAtPosition(i));
                if(time.getHour() > searchHour || (time.getHour() == searchHour && time.getMinute() >= searchMinute)) {
                    hour = time.getHour();
                    minute = time.getMinute();
                    break;
                }
            }

            // it may be too late in the evening to select the today item
            // or if FLAG_HIDE_TIME has been set, set it to tomorrow morning:
            if((hour == -1 && minute == -1) || shouldHideTime) {
                Calendar tomorrow = (Calendar) today.clone();
                tomorrow.add(Calendar.DAY_OF_YEAR, 1);
                date = getNextItemDate(tomorrow); // if this returns null it'll be set to today below
            }
        }
        if(date == null) {
            // it seems this spinner only contains past items, use the last one
            date = ((DateItem) dateSpinner.getItemAtPosition(dateSpinner.getLastItemPosition())).getDate();
        }

        if(hour == -1 && minute == -1) {
            // the date is not today, just select the earliest possible time
            final TimeItem time = ((TimeItem) timeSpinner.getItemAtPosition(0));
            hour = time.getHour();
            minute = time.getMinute();
        }

        // finally, select what we found
        date.set(Calendar.HOUR_OF_DAY, hour);
        date.set(Calendar.MINUTE, minute);
        setSelectedDate(date);
    }
943309
def previous_weekday(day=None, as_datetime=False):
    
    if day is None:
        day = datetime.datetime.now()
    else:
        day = datetime.datetime.strptime(day, '%Y-%m-%d')

    day -= datetime.timedelta(days=1)
    while day.weekday() > 4:  # Mon-Fri are 0-4
        day -= datetime.timedelta(days=1)

    if as_datetime:
        return day
    return day.strftime("%Y-%m-%d")
84494
def prevmonday(num):
    
    today = get_today()
    lastmonday = today - timedelta(days=today.weekday(), weeks=num)
    return lastmonday
495956
function(opts, day, abbr)
    {
        day += opts.firstDay;
        while (day >= 7) {
            day -= 7;
        }
        return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day];
    }
1025386
def _shift_date(self, direction, unit, *args):
        
        this_module = sys.modules[__name__]

        num_shifts = 1
        if len(args) > 0:
            num_shifts = int(args[0])

        if unit in ['monday', 'tuesday', 'wednesday', 'thursday', 'friday',
                    'saturday', 'sunday']:
            shift_func = move_datetime_namedday
            dt = shift_func(self._dt, direction, unit)
            if num_shifts > 1:
                for n in range(num_shifts - 1):
                    dt = shift_func(dt, direction, unit)
        else:
            shift_func = getattr(this_module, 'move_datetime_%s' % unit)
            dt = shift_func(self._dt, direction, num_shifts)

        return Delorean(datetime=dt.replace(tzinfo=None), timezone=self.timezone)
626927
function(weekBeginDate) {
        var overlaps = false;
        var nextWeek = this.add(weekBeginDate, this.DAY, 6);
        if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
            overlaps = true;
        }
        return overlaps;
    }
505281
def weekdays(first_day=None):
    
    if first_day is None:
        first_day = 'Monday'
    ix = _lower_weekdays().index(first_day.lower())
    return _double_weekdays()[ix:ix+7]
281178
def component_on_date(self, date: datetime.date) -> Optional["Interval"]:
        
        return self.intersection(Interval.wholeday(date))
558746
public DayOfTheWeek previous() {
        if (this == PH) {
            return null;
        }
        final int nextId = id - 1;
        for (final DayOfTheWeek dow : ALL) {
            if (dow.id == nextId) {
                return dow;
            }
        }
        return SUN;
    }