Skip to content

Commit f86f581

Browse files
committed
Revert "Adding validations for minimum and maximum dates"
This reverts commit 8899550.
1 parent 8899550 commit f86f581

File tree

21 files changed

+26
-57
lines changed

21 files changed

+26
-57
lines changed

form-validator/jquery.form-validator.js

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,8 +1958,6 @@
19581958
badTelephone: 'You have not given a correct phone number',
19591959
badSecurityAnswer: 'You have not given a correct answer to the security question',
19601960
badDate: 'You have not given a correct date',
1961-
badDateBefore: 'The minimum allowed date is ',
1962-
badDateAfter: 'The maximum allowed date is ',
19631961
lengthBadStart: 'The input value must be between ',
19641962
lengthBadEnd: ' characters',
19651963
lengthTooLongStart: 'The input value is longer than ',
@@ -2288,48 +2286,19 @@
22882286

22892287
/*
22902288
* Validate date
2291-
* element attrs (optional, and both must use the same format as the field)
2292-
* data-validation-min-date
2293-
* data-validation-max-date
22942289
*/
22952290
$.formUtils.addValidator({
22962291
name: 'date',
2297-
validatorFunction: function (date, $el, conf, lang) {
2292+
validatorFunction: function (date, $el, conf) {
22982293
var dateFormat = $el.valAttr('format') || conf.dateFormat || 'yyyy-mm-dd',
22992294
addMissingLeadingZeros = $el.valAttr('require-leading-zero') === 'false';
2300-
var dateParsed = $.formUtils.parseDate(date, dateFormat, addMissingLeadingZeros);
2301-
//checking date format
2302-
if (dateParsed === false){
2303-
this.errorMessage = lang.badDate;
2304-
return false;
2305-
}
2306-
var dateInput = new Date(dateParsed[0], dateParsed[1] - 1, dateParsed[2]);
2307-
//checking min date, when informed
2308-
var dateMinValue = $el.valAttr('min-date');
2309-
if (dateMinValue !== false && $.formUtils.parseDate(dateMinValue, dateFormat, addMissingLeadingZeros) !== false){
2310-
var dateMinParsed = $.formUtils.parseDate(dateMinValue, dateFormat, addMissingLeadingZeros);
2311-
var dateMin = new Date(dateMinParsed[0], dateMinParsed[1] - 1, dateMinParsed[2]);
2312-
if (dateInput < dateMin){
2313-
this.errorMessage = lang.badDateBefore + dateMinValue;
2314-
return false;
2315-
}
2316-
}
2317-
//checking max date, when informed
2318-
var dateMaxValue = $el.valAttr('max-date');
2319-
if (dateMaxValue !== false && $.formUtils.parseDate(dateMaxValue, dateFormat, addMissingLeadingZeros) !== false){
2320-
var dateMaxParsed = $.formUtils.parseDate(dateMaxValue, dateFormat, addMissingLeadingZeros);
2321-
var dateMax = new Date(dateMaxParsed[0], dateMaxParsed[1] - 1, dateMaxParsed[2]);
2322-
if (dateInput > dateMax){
2323-
this.errorMessage = lang.badDateAfter + dateMaxValue;
2324-
return false;
2325-
}
2326-
}
2327-
return true;
2328-
}
2329-
//errorMessage: '', //setted above on the function
2330-
//errorMessageKey: 'badDate' //not used
2295+
return $.formUtils.parseDate(date, dateFormat, addMissingLeadingZeros) !== false;
2296+
},
2297+
errorMessage: '',
2298+
errorMessageKey: 'badDate'
23312299
});
23322300

2301+
23332302
/*
23342303
* Validate group of checkboxes, validate qty required is checked
23352304
* written by Steve Wasiura : http://stevewasiura.waztech.com

form-validator/lang/ar.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/lang/ca.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/lang/cs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)