The last day of the month with the same day of week count as the date
specified.

@param {Date} d: The specified date
352737
function(d) {
    return d.dcEnd || (d.dcEnd =
      later.date.prev(
        later.Y.val(d),
        later.M.val(d),
        Math.min(later.dc.val(d) * 7, later.D.extent(d)[1])));
  }
1093399
def get_last_weekday_in_month(year, month, weekday):
        
        day = date(year, month, monthrange(year, month)[1])
        while True:
            if day.weekday() == weekday:
                break
            day = day - timedelta(days=1)
        return day
310076
function d3_time_parseWeekday(date, string, i) {
  d3_time_weekdayRe.lastIndex = 0;
  var n = d3_time_weekdayRe.exec(string.substring(i, i + 10));
  return n ? i += n[0].length : -1;
}
1066110
void formatLocalWeekday(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays, int firstDay) {
    if (width > 2) {
      formatWeekday(b, d, width, weekdays);
      return;
    }
    if (width == 2) {
      b.append('0');
    }
    formatWeekdayNumeric(b, d, firstDay);
  }
601476
function(offset) {
			var month = this.getOffsetMonth(offset)
			  , year = this.getOffsetYear(offset)

			// checks to see if february is a leap year otherwise return the respective # of days
			return (month == 1 && !(year & 3) && (year % 1e2 || !(year % 4e2))) ? 29 : this.daysInMonth[month]
		}
1183555
function weekNumber(d, firstWeekday) {
		firstWeekday = firstWeekday || 'sunday';
		// This works by shifting the weekday back by one day if we
		// are treating Monday as the first day of the week.
		var wday = d.getDay();
		if (firstWeekday == 'monday') {
			if (wday == 0) // Sunday
				wday = 6;
			else
				wday--;
		}
		var firstDayOfYear = new Date(d.getFullYear(), 0, 1)
			, yday = (d - firstDayOfYear) / 86400000
			, weekNum = (yday + 7 - wday) / 7
			;
		//    return Math.floor(weekNum);
		return weekNum | 0;
	}
1223980
def _days_in_month(date):
    """"""
    if date.month == 12:
        reference = type(date)(date.year + 1, 1, 1)
    else:
        reference = type(date)(date.year, date.month + 1, 1)
    return (reference - timedelta(days=1)).day
583279
function getWeekNumber(day) {
  var date = clone(day);
  date.setHours(0, 0, 0);
  date.setDate(date.getDate() + 4 - (date.getDay() || 7));
  return Math.ceil(((date - new Date(date.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7);
}
35448
void formatDayOfMonth(StringBuilder b, ZonedDateTime d, int width) {
    int day = d.getDayOfMonth();
    zeroPad2(b, day, width);
  }
764111
function passDays (date, term) {
  var from = this.from(date, term);
  return from ? this.diff(from, date, 'd') + 1 : null;
}
612914
function isDayAfter(d1, d2) {
  var day1 = clone(d1).setHours(0, 0, 0, 0);
  var day2 = clone(d2).setHours(0, 0, 0, 0);
  return day1 > day2;
}
995316
public static Date getFirstDayFromCurrentYear(Date d) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(d);                        
        cal.set(Calendar.MONTH, Calendar.JANUARY);
        cal.set(Calendar.DAY_OF_MONTH, 1);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return cal.getTime();
    }
225776
void formatDayOfWeekInMonth(StringBuilder b, ZonedDateTime d, int width) {
    int day = ((d.getDayOfMonth() - 1) / 7) + 1;
    b.append(day);
  }
1210365
function isSameDay(d1, d2) {
  if (!d1 || !d2) {
    return false;
  }
  return d1.getDate() === d2.getDate() && d1.getMonth() === d2.getMonth() && d1.getFullYear() === d2.getFullYear();
}
443802
public static Date getLastDayOfMonth(Date date){
        Calendar ca = Calendar.getInstance();
        ca.setTime(date);
        ca.set(Calendar.DAY_OF_MONTH,   1);
        Date firstDate = ca.getTime();
        return addDay(addMonth(firstDate, 1), -1);
    }
172778
public DateFuncSup subtract(DateSeperator d) {
                date.setTime(date.getTime() - d.parse());
                return this;
        }
931065
function(d) {
		"use strict";

		var f = this.options.weekStartOnMonday === true ? d3.time.format("%W"): d3.time.format("%U");
		return f(d);
	}