Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onadd() {
// Browser supports type=date natively
if (modernizr.inputtypes['datetime-local']) {
return;
}
// disabled, readonly or already applied
if (this.prop('disabled') || this.prop('readonly') || this.hasClass('hasDatepicker')) {
return;
}
// Duplicate input field to store ISO value
const hiddenInput = $(
'<input>',
{ type: 'hidden', name: this.attr('name'), value: this.val() }
);
this.parent().append(hiddenInput);
// Avoid original field being saved
onadd() {
// Browser supports type=date natively
if (modernizr.inputtypes.date) {
return;
}
// disabled, readonly or already applied
if (this.prop('disabled') || this.prop('readonly') || this.hasClass('hasDatepicker')) {
return;
}
// Duplicate input field to store ISO value
const hiddenInput = $(
'<input>',
{ type: 'hidden', name: this.attr('name'), value: this.val() }
);
this.parent().append(hiddenInput);
// Avoid original field being saved