浏览代码

#179: Use $.fn.bootstrapValidator.helpers.date helper in the vat validator

phuoc 11 年之前
父节点
当前提交
074532a6d9
共有 4 个文件被更改,包括 14 次插入26 次删除
  1. 7 7
      CHANGELOG.md
  2. 3 9
      dist/js/bootstrapValidator.js
  3. 1 1
      dist/js/bootstrapValidator.min.js
  4. 3 9
      src/js/validator/vat.js

+ 7 - 7
CHANGELOG.md

@@ -2,7 +2,7 @@
 
 
 ## v0.4.5 (not released yet)
 ## v0.4.5 (not released yet)
 
 
-* Add ```$.fn.bootstrapValidator.helpers.date``` for validating a date, re-used in ```date```, ```id``` validators
+* Add ```$.fn.bootstrapValidator.helpers.date``` for validating a date, re-used in ```date```, ```id```, [```vat```](http://bootstrapvalidator.com/validators/vat/) validators
 * [#233](https://github.com/nghuuphuoc/bootstrapvalidator/issues/233): Add ```threshold``` option
 * [#233](https://github.com/nghuuphuoc/bootstrapvalidator/issues/233): Add ```threshold``` option
 * [#232](https://github.com/nghuuphuoc/bootstrapvalidator/issues/232): Add ```id``` validator
 * [#232](https://github.com/nghuuphuoc/bootstrapvalidator/issues/232): Add ```id``` validator
 * When parsing options from HTML attributes, don't add the field which hasn't validators. It improves fixes for [#191](https://github.com/nghuuphuoc/bootstrapvalidator/issues/191), [#223](https://github.com/nghuuphuoc/bootstrapvalidator/issues/223)
 * When parsing options from HTML attributes, don't add the field which hasn't validators. It improves fixes for [#191](https://github.com/nghuuphuoc/bootstrapvalidator/issues/191), [#223](https://github.com/nghuuphuoc/bootstrapvalidator/issues/223)
@@ -10,12 +10,12 @@
 ## v0.4.4 (2014-05-05)
 ## v0.4.4 (2014-05-05)
 
 
 * Add ```$.fn.bootstrapValidator.helpers.mod_11_10``` method that implements modulus 11, 10 (ISO 7064) algorithm. The helper is then reused in validating [German and Croatian VAT](http://bootstrapvalidator.com/validators/vat/) numbers
 * Add ```$.fn.bootstrapValidator.helpers.mod_11_10``` method that implements modulus 11, 10 (ISO 7064) algorithm. The helper is then reused in validating [German and Croatian VAT](http://bootstrapvalidator.com/validators/vat/) numbers
-* Add ```$.fn.bootstrapValidator.helpers.mod_37_36``` method that implements modulus 37, 36 (ISO 7064) algorithm, used in GRid validator
-* [#213](https://github.com/nghuuphuoc/bootstrapvalidator/issues/213): Add EAN (International Article Number) validator
-* [#214](https://github.com/nghuuphuoc/bootstrapvalidator/issues/214): Add GRId (Global Release Identifier) validator
-* [#215](https://github.com/nghuuphuoc/bootstrapvalidator/issues/215): Add IMEI (International Mobile Station Equipment Identity) validator
-* [#216](https://github.com/nghuuphuoc/bootstrapvalidator/issues/216): Add ISMN (International Standard Music Number) validator
-* [#217](https://github.com/nghuuphuoc/bootstrapvalidator/issues/217): Add ISSN (International Standard Serial Number) validator
+* Add ```$.fn.bootstrapValidator.helpers.mod_37_36``` method that implements modulus 37, 36 (ISO 7064) algorithm, used in [GRid validator](http://bootstrapvalidator.com/validators/grid/)
+* [#213](https://github.com/nghuuphuoc/bootstrapvalidator/issues/213): Add [EAN (International Article Number) validator](http://bootstrapvalidator.com/validators/ean/)
+* [#214](https://github.com/nghuuphuoc/bootstrapvalidator/issues/214): Add [GRId (Global Release Identifier) validator](http://bootstrapvalidator.com/validators/grid/)
+* [#215](https://github.com/nghuuphuoc/bootstrapvalidator/issues/215): Add [IMEI (International Mobile Station Equipment Identity) validator](http://bootstrapvalidator.com/validators/imei/)
+* [#216](https://github.com/nghuuphuoc/bootstrapvalidator/issues/216): Add [ISMN (International Standard Music Number) validator](http://bootstrapvalidator.com/validators/ismn/)
+* [#217](https://github.com/nghuuphuoc/bootstrapvalidator/issues/217): Add [ISSN (International Standard Serial Number) validator](http://bootstrapvalidator.com/validators/issn/)
 * [#191](https://github.com/nghuuphuoc/bootstrapvalidator/issues/191), [#223](https://github.com/nghuuphuoc/bootstrapvalidator/issues/223): Support using both the ```name``` attribute and ```selector``` option for field
 * [#191](https://github.com/nghuuphuoc/bootstrapvalidator/issues/191), [#223](https://github.com/nghuuphuoc/bootstrapvalidator/issues/223): Support using both the ```name``` attribute and ```selector``` option for field
 * [#206](https://github.com/nghuuphuoc/bootstrapvalidator/issues/206): Indicate success/error tab
 * [#206](https://github.com/nghuuphuoc/bootstrapvalidator/issues/206): Indicate success/error tab
 * [#220](https://github.com/nghuuphuoc/bootstrapvalidator/issues/220): Add UK postcode support for the [```zipCode``` validator](http://bootstrapvalidator.com/validators/zipCode/)
 * [#220](https://github.com/nghuuphuoc/bootstrapvalidator/issues/220): Add UK postcode support for the [```zipCode``` validator](http://bootstrapvalidator.com/validators/zipCode/)

+ 3 - 9
dist/js/bootstrapValidator.js

@@ -3197,9 +3197,7 @@
                             month -= 20;
                             month -= 20;
                         }
                         }
 
 
-                        try {
-                            var d = new Date(year, month, day);
-                        } catch (ex) {
+                        if (!$.fn.bootstrapValidator.helpers.date(year, month, day)) {
                             return false;
                             return false;
                         }
                         }
 
 
@@ -3384,9 +3382,7 @@
                     year += 100;
                     year += 100;
                 }
                 }
 
 
-                try {
-                    var d = new Date(year, month, day);
-                } catch (ex) {
+                if (!$.fn.bootstrapValidator.helpers.date(year, month, day)) {
                     return false;
                     return false;
                 }
                 }
 
 
@@ -3897,9 +3893,7 @@
                     year  = parseInt(value.substr(4, 2));
                     year  = parseInt(value.substr(4, 2));
                 year = year + 1800 + parseInt(value.charAt(6)) * 100;
                 year = year + 1800 + parseInt(value.charAt(6)) * 100;
 
 
-                try {
-                    var d = new Date(year, month, day);
-                } catch (ex) {
+                if (!$.fn.bootstrapValidator.helpers.date(year, month, day)) {
                     return false;
                     return false;
                 }
                 }
 
 

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


+ 3 - 9
src/js/validator/vat.js

@@ -146,9 +146,7 @@
                             month -= 20;
                             month -= 20;
                         }
                         }
 
 
-                        try {
-                            var d = new Date(year, month, day);
-                        } catch (ex) {
+                        if (!$.fn.bootstrapValidator.helpers.date(year, month, day)) {
                             return false;
                             return false;
                         }
                         }
 
 
@@ -333,9 +331,7 @@
                     year += 100;
                     year += 100;
                 }
                 }
 
 
-                try {
-                    var d = new Date(year, month, day);
-                } catch (ex) {
+                if (!$.fn.bootstrapValidator.helpers.date(year, month, day)) {
                     return false;
                     return false;
                 }
                 }
 
 
@@ -846,9 +842,7 @@
                     year  = parseInt(value.substr(4, 2));
                     year  = parseInt(value.substr(4, 2));
                 year = year + 1800 + parseInt(value.charAt(6)) * 100;
                 year = year + 1800 + parseInt(value.charAt(6)) * 100;
 
 
-                try {
-                    var d = new Date(year, month, day);
-                } catch (ex) {
+                if (!$.fn.bootstrapValidator.helpers.date(year, month, day)) {
                     return false;
                     return false;
                 }
                 }