if i want to validate date of in Text box like 11-jul-2009 using javascript as Per cluture then how can i do Pleas tell me if any body know that....?
I am using this function....
function isDate(obj)
{
var retVal = false;
var dteDate;
/* Check for mm/dd/yyy format */
obj1 = obj.split("/");
obj1[0] = parseInt(obj1[0], 10)-1; //for javascript 0=>January!
obj1[1] = parseInt(obj1[1], 10);
obj1[2] = parseInt(obj1[2], 10);
dteDate=new Date(obj1[2], obj1[0], obj1[1]);
retVal = ((obj1[1]==dteDate.getDate()) && (obj1[0]==dteDate.getMonth()) && (obj1[2]==dteDate.getFullYear()));
/* Check for dd-mmm-yyy format */
if(retVal == false)
{
obj1 = obj.split("-");
if (obj1.length<3) return false;
var month = isDate.months[obj1[1].toLowerCase()];
if (typeof month != "number") return false;
obj1[0] = parseInt(obj1[0], 10);
obj1[1] = parseInt(month, 10)-1; //for javascript 0=>January!
obj1[2] = parseInt(obj1[2], 10);
dteDate=new Date(obj1[2], obj1[1], obj1[0]);
retVal=(obj1[0]==dteDate.getDate()) && (obj1[1]==dteDate.getMonth()) && (obj1[2]==dteDate.getFullYear());
}
return retVal;
}
isDate.months = {
jan: 0, feb: 1, mar: 2, apr: 3, may: 4, jun: 5,
jul: 6, aug: 7, sep: 8, oct: 9, nov: 10, dec: 11
};
in abouve function how can i used date validation as per Currrent culture like we are using fr-FR then its giving error to validate ....:( so Plesa tell me what another way to sloved this Problem ....?