Open AFatNiBBa opened 5 days ago
As a temporary workaround, you can manually produce the desired output format using onUnMask
event handler like this:
$("#field").inputmask({
alias: "datetime",
inputFormat: workingVersion ? "dd/mm/yyyy" : ' dd mm yyyy ',
placeholder: "_",
onUnMask: (maskedValue, unMaskedValue) => {
const parts = maskedValue.trim().split(/\s+/);
return parts[2] + '-' + parts[1] + '-' + parts[0];
},
oncomplete() {
$("#out").text($(this).inputmask('unmaskedvalue'));
}
});
Description
There's a bug when getting the unmasked value if the "shape" of the
inputFormat
is different from theoutputFormat
's one. In this CodePen I made a variable calledworkingVersion
that chooses whichinputFormat
to use.If you set it to
true
it will use"dd/mm/yyyy"
, and the value you insert will be unmasked correctly, while if you set it tofalse
it will use' dd mm yyyy '
, which doesn't work.If, on the HTML panel, you change the version of the script that imports the library from
5.0.9
to5.0.8
, everything works fineInfo