/*
Check if date is in school year
542309
public function dateInRange($val, DataContainer $dc) {
		$year = $this->Database->prepare("SELECT start,end FROM tl_schoolyear WHERE id = ? LIMIT 1")
		->execute($dc->activeRecord->pid)
		->fetchAssoc();
		
		if($val < $year['start'] || $val > $year['end']) {
			throw new \Exception('Date must be in range of the school year');
		}
		else return $val;
	}
3178
public static Matcher<Date> hasYearMonthAndDay(final int year, final int month, final int day) {
        return new IsDate(year, month, day);
    }
581996
function fuzzydate(s) {
	var o = new Date(s), n = new Date(NaN);
	var y = o.getYear(), m = o.getMonth(), d = o.getDate();
	if(isNaN(d)) return n;
	if(y < 0 || y > 8099) return n;
	if((m > 0 || d > 1) && y != 101) return o;
	if(s.toLowerCase().match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) return o;
	if(!s.match(/[a-zA-Z]/)) return o;
	return n;
}
1236585
def is_this_year(self):
        """"""
        return is_current_year(datetime.datetime.combine(self.date, datetime.time()))
1026015
function isSameDay(d1, d2) {
      return d1.getDate() == d2.getDate() && isSameMonthAndYear(d1, d2);
    }
542233
private static int getMonthOfYear(int dayOfYear, int year) {

        Integer[] newMonths = getAdjustedMonthDays(year);

        if (dayOfYear >= 0) {
            for (int i = 0; i < newMonths.length; i++) {
                if (dayOfYear < newMonths[i].intValue()) {
                    return i - 1;
                }
            }
            return 11;
        } else {
            dayOfYear = (isLeapYear(year) ? (dayOfYear + 355)
                    : (dayOfYear + 354));
            for (int i = 0; i < newMonths.length; i++) {
                if (dayOfYear < newMonths[i].intValue()) {
                    return i - 1;
                }
            }
            return 11;
        }
    }
1118420
function isValidDate(year, month, date) { // eslint-disable-line complexity
    var isValidYear, isValidMonth, isValid, lastDayInMonth;

    year = Number(year);
    month = Number(month);
    date = Number(date);

    isValidYear = (year > -1 && year < 100) || ((year > 1969) && (year < 2070));
    isValidMonth = (month > 0) && (month < 13);

    if (!isValidYear || !isValidMonth) {
        return false;
    }

    lastDayInMonth = MONTH_DAYS[month];
    if (month === 2 && year % 4 === 0) {
        if (year % 100 !== 0 || year % 400 === 0) {
            lastDayInMonth = 29;
        }
    }

    isValid = (date > 0) && (date <= lastDayInMonth);

    return isValid;
}
549263
function(inst) {
		var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
			this._daylightSavingAdjust(new Date(
			inst.currentYear, inst.currentMonth, inst.currentDay)));
			return startDate;
	}
804682
function isSeasonHoliday (date) {
  date = this.toDate(date);
  if (!date) {
    return false;
  }

  var season = this._seasonHoliday;

  if (!season) {
    return false;

  } else if (typeof season === 'function') {
    return season(date);

  } else {
    var key = (date.getMonth() + 1) * 100 + date.getDate() * 1;
    return season[key] || false;
  }
}
812202
public static  boolean isDate(String str) {  
    	try {
    		DateUtils.parseDate(str);
    		return true;
		} catch (Exception e) {
			return false;
		}
    }
1052726
function getDayOfYear (date, year) {
  date = toStringDate(date)
  if (baseExports.isDate(date)) {
    return baseExports.isLeapYear(getWhatYear(date, year)) ? 366 : 365
  }
  return date
}
659515
function startOfYear() {
      var result = this.clone();
      result.day = 1;
      result.month = 1;
      result.isDate = true;
      result.hour = 0;
      result.minute = 0;
      result.second = 0;
      return result;
    }
650187
function(year) {
			this._validate(year, this.minMonth, this.minDay,
				$.calendars.local.invalidYear || $.calendars.regionalOptions[''].invalidYear);
			return 12;
		}
77167
function isSameMonthAndYear(d1, d2) {
      return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth();
    }
1125273
function( inst ) {
            var stepMonths = this._get( inst, "stepMonths" ),
                id = "#" + inst.id.replace( /\\\\/g, "\\" );
            inst.dpDiv.find( "[data-handler]" ).map( function() {
                var handler = {
                    prev: function() {
                        $.datepicker._adjustDate( id, -stepMonths, "M" );
                    },
                    next: function() {
                        $.datepicker._adjustDate( id, +stepMonths, "M" );
                    },
                    hide: function() {
                        $.datepicker._hideDatepicker();
                    },
                    today: function() {
                        $.datepicker._gotoToday( id );
                    },
                    selectDay: function() {
                        $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );
                        return false;
                    },
                    selectMonth: function() {
                        $.datepicker._selectMonthYear( id, this, "M" );
                        return false;
                    },
                    selectYear: function() {
                        $.datepicker._selectMonthYear( id, this, "Y" );
                        return false;
                    }
                };
                $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );
            } );
        }
1294271
function(year) {
			var date = this._validate(year, this.minMonth, this.minDay, $.calendars.local.invalidYear);
			year = date.year();
			var baktun = Math.floor(year / 400);
			year = year % 400;
			year += (year < 0 ? 400 : 0);
			var katun = Math.floor(year / 20);
			return baktun + '.' + katun + '.' + (year % 20);
		}
129459
function(nYear) {
        var yrPattern = YAHOO.widget.CalendarNavigator.YR_PATTERN;
        if (YAHOO.lang.isNumber(nYear) && yrPattern.test(nYear+"")) {
            this._year = nYear;
        }
        this._updateYearUI();
    }