(tmpYear % 400 == 0)){
theMonthDay++;
}
}
return(theMonthDay);
}
this.SetDateFormat = function(theYear, theMonth, theDay){//format a date to this.DateFormat
var theDate = this.DateFormat;
var tmpYear = this.GetFormatYear(theYear);
var tmpMonth = theMonth;
if (tmpMonth < 0){
tmpMonth = 0;
}
if (tmpMonth > 11){
tmpMonth = 11;
}
var tmpDay = theDay;
if (tmpDay < 1){
tmpDay = 1;
}else{
tmpDay = this.GetMonthDays(tmpYear, tmpMonth);
if (theDay < tmpDay){
tmpDay = theDay;
}
}
theDate = theDate.replace(/<yyyy>/g, tmpYear.toString());
theDate = theDate.replace(/<yy>/g, tmpYear.toString().substr(2,2));
theDate = theDate.replace(/<MMMMMM>/g, this.MonthName[tmpMonth]);
theDate = theDate.replace(/<MMM>/g, this.MonthName[tmpMonth].substr(0,3));
if (theMonth < 9){
theDate = theDate.replace(/<mm>/g, "0" + (tmpMonth + 1).toString());
}else{
theDate = theDate.replace(/<mm>/g, (tmpMonth + 1).toString());
}
theDate = theDate.replace(/<m>/g, (tmpMonth + 1).toString());
if (theDay < 10){
theDate = theDate.replace(/<dd>/g, "0" + tmpDay.toString());
}else{
theDate = theDate.replace(/<dd>/g, tmpDay.toString());
}
theDate = theDate.replace(/<d>/g, tmpDay.toString());
return(theDate);
}
this.GetTextDate = function(theString){ //convert a string to a date, if the string is not a date, return a empty string
var i = 0, tmpChar = "", find_tag = "";
var start_at = 0, end_at = 0, year_at = 0, month_at = 0, day_at = 0;
var tmp_at = 0, one_at = 0, two_at = 0, one_days = 0, two_days = 0;
var aryDate = new Array();
var tmpYear = -1, tmpMonth = -1, tmpDay = -1;
var tmpDate = theString.toLowerCase();
var defDate = "";
end_at = tmpDate.length;
for (i=1;i<end_at;i++){
if (tmpDate.charAt(i)=="0"){
tmpChar = tmpDate.charAt(i-1);
if (tmpChar<"0"
关键词:“javascript做的日历”改进版