not sure if this is useful to anyone, its an extension to guess the date
sort of like date parsing but more useful i guess

it is the first cut, so there might be some bugs in it
please let me know if you find bugs or improvements

// Date Guess Extension
// 12 Oct 2006 – bumperbox {at} gmail.com

// Static definition of time in millis for convenience
Date.MILLIS_SECOND = 1000;
Date.MILLIS_MINUTE = 60000;
Date.MILLIS_HOUR = 3600000;
Date.MILLIS_DAY = 86400000;
Date.MILLIS_WEEK = 604800000;

// 2 digit years less then turn of century are assumed to be this century
Date.TURN_OF_CENTURY = 1950;

// Guess date based on the following rules
// date order can either be DMY or MDY
// you can use . / (space) – as separators or no separators
//
// 0 = today
// = = today
// + = today + 1 day
// – = today – 1 day
// +n = today + n days
// -n = today – n days
// yyyy-mm-dd = iso date
// dd = date, assuming current month and year
// mm/dd or dd/mm = date and month, assuming current year
// 2 digits years 1) {
// matched on iso date, ignore first value in array it is empty, put in YMD order
nYear = aryIsoDate[2];
nMonth = aryIsoDate[3];
nDayOfMonth = aryIsoDate[4];

} else {

// convert all delimiters to spaces, add more delimiters here if required
sDate = sDate.replace(/[\/\.-]/g, ” “).trim();

// if there are no delimiters, it must be ddmmyy or ddmmyyyy, add delimiters
if (sDate.indexOf(” “) == -1) {
if (sDate.length == 6 || sDate.length == 8) {
sDate = sDate.substr(0,2) + ” ” + sDate.substr(2, 2) + ” ” + sDate.substr(4);
}
}

// split date into parts
var aryDate = sDate.split(” “);

if (sDateOrder == “DMY”) {
nDayOfMonth = aryDate[0];
nMonth = aryDate[1];
nYear = aryDate[2];
} else if (sDateOrder == “MDY”) {
if (sDate.length