Date.prototype.getWeekday = function(weekdayArray){
// Type String would fiddle things up. object, number, function return 'undefined' on length method.
try {
if (weekdayArray && weekdayArray.length === 7) {
typeof weekdayArray == 'string' ? function(){throw "TypeException"}() : this.weekdays = weekdayArray;
}
}
catch(exception) {
alert(exception + ": optional param of Date.getWeekday() must be an Array, not "+ typeof weekdayArray);
};
return (this.weekdays||["Sun","Mon","Tue","Wed","Thur","Fri","Sat"])[this.getDay()];
};
Date.prototype.getMonthname = function(monthsArray) {
// Type String would fiddle things up. object, number, function return 'undefined' on length method.
try {
if (monthsArray && monthsArray === 12) {
typeof monthsArray == 'string' ? function(){throw "TypeException"}() : this.months = monthsArray;
}
}
catch(exception) {
alert(exception + ": optional param of Date.getMonthname() must be an Array, not "+ typeof monthsArray);
};
return (this.months||["January","February","March","April","May","June","July","August","September","October","November","December"])[this.getMonth()];
};