|
@@ -1912,6 +1912,51 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (d2 == value.charAt(10));
|
|
return (d2 == value.charAt(10));
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Validate Czech national identification number (RC)
|
|
|
|
|
+ * Examples:
|
|
|
|
|
+ * - Valid: 7103192745, 991231123
|
|
|
|
|
+ * - Invalid: 1103492745, 590312123
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param {String} value The ID
|
|
|
|
|
+ * @returns {Boolean}
|
|
|
|
|
+ */
|
|
|
|
|
+ _cz: function(value) {
|
|
|
|
|
+ if (!/^\d{9,10}$/.test(value)) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ var year = 1900 + parseInt(value.substr(0, 2)),
|
|
|
|
|
+ month = parseInt(value.substr(2, 2)) % 50 % 20,
|
|
|
|
|
+ day = parseInt(value.substr(4, 2));
|
|
|
|
|
+ if (value.length == 9) {
|
|
|
|
|
+ if (year >= 1980) {
|
|
|
|
|
+ year -= 100;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (year > 1953) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (year < 1954) {
|
|
|
|
|
+ year += 100;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ var d = new Date(year, month, day);
|
|
|
|
|
+ } catch (ex) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Check that the birth date is not in the future
|
|
|
|
|
+ if (value.length == 10) {
|
|
|
|
|
+ var check = parseInt(value.substr(0, 9), 10) % 11;
|
|
|
|
|
+ if (year < 1985) {
|
|
|
|
|
+ check = check % 10;
|
|
|
|
|
+ }
|
|
|
|
|
+ return (check == value.substr(9, 1));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
}(window.jQuery));
|
|
}(window.jQuery));
|