浏览代码

#681: Fix the date validator issue

phuoc 11 年之前
父节点
当前提交
3780fd6b23

+ 1 - 1
dist/css/bootstrapValidator.min.css

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.1-dev, built on 2014-08-17 7:49:08 AM
+ * @version     v0.5.1-dev, built on 2014-08-17 8:15:18 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 3 - 3
dist/js/bootstrapValidator.js

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.1-dev, built on 2014-08-17 7:49:08 AM
+ * @version     v0.5.1-dev, built on 2014-08-17 8:15:18 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
@@ -1772,7 +1772,7 @@
             if (isNaN(year) || isNaN(month) || isNaN(day)) {
                 return false;
             }
-            if (day.length > 2 || month.length > 2 || year.length !== 4) {
+            if (day.length > 2 || month.length > 2 || year.length > 4) {
                 return false;
             }
 
@@ -2409,7 +2409,7 @@
                 month = date[$.inArray('MM', dateFormat)],
                 day   = date[$.inArray('DD', dateFormat)];
 
-            if (!year || !month || !day) {
+            if (!year || !month || !day || year.length !== 4) {
                 return false;
             }
 

文件差异内容过多而无法显示
+ 3 - 3
dist/js/bootstrapValidator.min.js


+ 1 - 1
src/js/bootstrapValidator.js

@@ -1771,7 +1771,7 @@
             if (isNaN(year) || isNaN(month) || isNaN(day)) {
                 return false;
             }
-            if (day.length > 2 || month.length > 2 || year.length !== 4) {
+            if (day.length > 2 || month.length > 2 || year.length > 4) {
                 return false;
             }
 

+ 1 - 1
src/js/validator/date.js

@@ -68,7 +68,7 @@
                 month = date[$.inArray('MM', dateFormat)],
                 day   = date[$.inArray('DD', dateFormat)];
 
-            if (!year || !month || !day) {
+            if (!year || !month || !day || year.length !== 4) {
                 return false;
             }