Browse Source

#179: Validate Luxembourg VAT number

phuoc 11 years ago
parent
commit
c27c1a2256
3 changed files with 29 additions and 1 deletions
  1. 14 0
      dist/js/bootstrapValidator.js
  2. 1 1
      dist/js/bootstrapValidator.min.js
  3. 14 0
      src/js/validator/vat.js

+ 14 - 0
dist/js/bootstrapValidator.js

@@ -2502,6 +2502,20 @@
             }
 
             return (sum % 10 == 0);
+        },
+
+        /**
+         * Validate Luxembourg VAT number
+         * Examples:
+         * - Valid: LU15027442
+         * - Invalid: LU15027443
+         *
+         * @param {String} value VAT number
+         * @return {Boolean}
+         */
+        _isValidLUVat: function(value) {
+            value = value.substr(2);
+            return (value.substr(0, 6) % 89 == value.substr(6, 2));
         }
     };
 }(window.jQuery));

File diff suppressed because it is too large
+ 1 - 1
dist/js/bootstrapValidator.min.js


+ 14 - 0
src/js/validator/vat.js

@@ -128,6 +128,20 @@
             }
 
             return (sum % 10 == 0);
+        },
+
+        /**
+         * Validate Luxembourg VAT number
+         * Examples:
+         * - Valid: LU15027442
+         * - Invalid: LU15027443
+         *
+         * @param {String} value VAT number
+         * @return {Boolean}
+         */
+        _isValidLUVat: function(value) {
+            value = value.substr(2);
+            return (value.substr(0, 6) % 89 == value.substr(6, 2));
         }
     };
 }(window.jQuery));