Code: Select all
if (PrimeFaces.widget.Calendar) {
PrimeFaces.widget.Calendar.prototype.applyMask = function() {
if (this.cfg.inline || this.input.is('[readonly]') || this.input.is(':disabled')) {
return;
}
if (this.cfg.mask) {
var maskCfg = {
placeholder: this.cfg.maskSlotChar || '_',
clearMaskOnLostFocus: this.cfg.maskAutoClear || true,
clearIncomplete: this.cfg.maskAutoClear || true,
autoUnmask: false
};
var pattern = new RegExp("m|d|y|h|s", 'i');
var isAlias = pattern.test(this.cfg.mask);
if (isAlias) {
maskCfg.alias = 'datetime';
maskCfg.inputFormat = this.cfg.mask;
} else {
maskCfg.mask = this.cfg.mask;
}
this.input.inputmask('remove').inputmask(maskCfg);
}
}
}
if (PrimeFaces.widget.DatePicker) {
PrimeFaces.widget.DatePicker.prototype.applyMask = function() {
if (this.cfg.inline || this.input.is('[readonly]') || this.input.is(':disabled')) {
return;
}
if (this.cfg.mask) {
var maskCfg = {
placeholder: this.cfg.maskSlotChar || '_',
clearMaskOnLostFocus: this.cfg.maskAutoClear || true,
clearIncomplete: this.cfg.maskAutoClear || true,
autoUnmask: false
};
var pattern = new RegExp("m|d|y|h|s", 'i');
var isAlias = pattern.test(this.cfg.mask);
if (isAlias) {
maskCfg.alias = 'datetime';
maskCfg.inputFormat = this.cfg.mask;
} else {
maskCfg.mask = this.cfg.mask;
}
this.input.inputmask('remove').inputmask(maskCfg);
}
}
}