Fix indentation
This commit is contained in:
parent
b97b3281d5
commit
09ae4e5fbc
@ -100,37 +100,37 @@ function isDate(val,tmstmp)
|
||||
}
|
||||
val=arrayVal.join("-");
|
||||
var pos=2;
|
||||
dtexp=new RegExp(/^([0-9]{4})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30)))$/);
|
||||
if (val.length == 8) {
|
||||
dtexp=new RegExp(/^([0-9]{2})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30)))$/);
|
||||
pos=0;
|
||||
}
|
||||
if (dtexp.test(val)) {
|
||||
var month=parseInt(val.substring(pos+3,pos+5));
|
||||
var day=parseInt(val.substring(pos+6,pos+8));
|
||||
var year=parseInt(val.substring(0,pos+2));
|
||||
if (month == 2 && day > daysInFebruary(year)) {
|
||||
return false;
|
||||
}
|
||||
if (val.substring(0, pos + 2).length == 2) {
|
||||
if (val.substring(0, pos + 2).length == 2) {
|
||||
year=parseInt("20" + val.substring(0,pos+2));
|
||||
} else {
|
||||
year=parseInt("19" + val.substring(0,pos+2));
|
||||
}
|
||||
}
|
||||
if (tmstmp == true) {
|
||||
if (year < 1978) {
|
||||
return false;
|
||||
}
|
||||
if (year > 2038 || (year > 2037 && day > 19 && month >= 1) || (year > 2037 && month > 1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dtexp=new RegExp(/^([0-9]{4})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30)))$/);
|
||||
if (val.length == 8) {
|
||||
dtexp=new RegExp(/^([0-9]{2})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30)))$/);
|
||||
pos=0;
|
||||
}
|
||||
if (dtexp.test(val)) {
|
||||
var month=parseInt(val.substring(pos+3,pos+5));
|
||||
var day=parseInt(val.substring(pos+6,pos+8));
|
||||
var year=parseInt(val.substring(0,pos+2));
|
||||
if (month == 2 && day > daysInFebruary(year)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
if (val.substring(0, pos + 2).length == 2) {
|
||||
if (val.substring(0, pos + 2).length == 2) {
|
||||
year=parseInt("20" + val.substring(0,pos+2));
|
||||
} else {
|
||||
year=parseInt("19" + val.substring(0,pos+2));
|
||||
}
|
||||
}
|
||||
if (tmstmp == true) {
|
||||
if (year < 1978) {
|
||||
return false;
|
||||
}
|
||||
if (year > 2038 || (year > 2037 && day > 19 && month >= 1) || (year > 2037 && month > 1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* function to check the validity of time
|
||||
|
||||
Loading…
Reference in New Issue
Block a user