Roo/bootstrap/DateField.js
[roojs1] / Roo / bootstrap / DateField.js
index 2ecf812..9c25a53 100644 (file)
@@ -930,6 +930,10 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input,  {
     
     validateValue : function(value)
     {
+        if(this.getVisibilityEl().hasClass('hidden')){
+            return true;
+        }
+        
         if(value.length < 1)  {
             if(this.allowBlank){
                 return true;
@@ -960,17 +964,36 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input,  {
             return false;
         }
         
+        if(typeof(this.parseDate(value)) == 'undefined'){
+            return false;
+        }
+        
         if (this.endDate !== Infinity && this.parseDate(value).getTime() > this.endDate.getTime()) {
             return false;
         }      
         
-        if (this.startDate !== Infinity && this.parseDate(value).getTime() > this.endDate.getTime()) {
+        if (this.startDate !== -Infinity && this.parseDate(value).getTime() < this.startDate.getTime()) {
             return false;
         } 
         
         
         return true;
     },
+    
+    setVisible : function(visible)
+    {
+        if(!this.getEl()){
+            return;
+        }
+        
+        this.getEl().removeClass('hidden');
+        
+        if(visible){
+            return;
+        }
+        
+        this.getEl().addClass('hidden');
+    }
    
 });