From b97b3281d5601e83d84cd9c66240cdfc5d8f63d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 25 Apr 2012 10:18:28 +0200 Subject: [PATCH] Coding style improvements --- js/tbl_change.js | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/js/tbl_change.js b/js/tbl_change.js index bd473085fb..ff443b8a8c 100644 --- a/js/tbl_change.js +++ b/js/tbl_change.js @@ -91,43 +91,45 @@ function fractionReplace(num) */ function isDate(val,tmstmp) { - val=val.replace(/[.|*|^|+|//|@]/g,'-'); - var arrayVal=val.split("-"); - for(var a=0;adaysInFebruary(year)) + 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; + 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)); } - } - else + } + 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; }