Files
medicalalert-web-reloaded/wp/wp-content/plugins/campaign-tracking/res/js/campaign.metabox.js
2024-09-17 10:50:03 -04:00

36 lines
887 B
JavaScript

function initMetabox(){
console.log("** initMetabox **");
var dateFormat = "yy-mm-dd",
from = $( "#campaign_start_date" )
.datepicker({
dateFormat: dateFormat
})
.on( "change", function() {
to.datepicker( "option", "minDate", getDate( this ) );
}),
to = $( "#campaign_end_date" ).datepicker({
dateFormat: dateFormat
}).on( "change", function() {
from.datepicker( "option", "maxDate", getDate( this ) );
});
function getDate( element ) {
var date;
try {
date = $.datepicker.parseDate( dateFormat, element.value );
} catch( error ) {
date = null;
}
return date;
}
}
if($ == undefined){
window.$ = jQuery.noConflict();
}
$(function(){
initMetabox();
});