first commit
This commit is contained in:
25
plugins/jquery-validation/polish/validator.date-max.js
Normal file
25
plugins/jquery-validation/polish/validator.date-max.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/* eslint-disable func-names */
|
||||
|
||||
import { getDate } from "./date";
|
||||
|
||||
/* Validator max date */
|
||||
function msgMaxDate(max) {
|
||||
return `Proszę wprowadzić datę przed ${max}`;
|
||||
}
|
||||
|
||||
/* Max date must be in format rrrr-mm-dd */
|
||||
jQuery.validator.addMethod(
|
||||
"date_max",
|
||||
function(value, element, params) {
|
||||
let max;
|
||||
let d;
|
||||
try {
|
||||
d = getDate(value);
|
||||
max = getDate(params);
|
||||
} catch (e) {
|
||||
return this.optional(element) || false;
|
||||
}
|
||||
return this.optional(element) || d.compareTo(max) === -1;
|
||||
},
|
||||
msgMaxDate
|
||||
);
|
||||
Reference in New Issue
Block a user