Skip to content

Instantly share code, notes, and snippets.

@ryanurban
Forked from ckpicker/gist:7030311
Last active December 25, 2015 19:49
Show Gist options
  • Save ryanurban/7030403 to your computer and use it in GitHub Desktop.
Save ryanurban/7030403 to your computer and use it in GitHub Desktop.
add_action( 'wp_footer', 'community_add_javascript', 100 );
function community_add_javascript() {
if ( tribe_is_community_edit_event_page() ) {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
// Customize Events Community Datepicker
if(jQuery("#EventStartDate, #EventEndDate").length) {
var datepickerOpts = {
dateFormat: 'mm-dd-yy',
changeMonth: true,
changeYear: true,
onSelect: function(selectedDate) {
var option = this.id == "EventStartDate" ? "minDate" : "maxDate";
var instance = jQuery(this).data("datepicker");
var date = jQuery.datepicker.parseDate(instance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat, selectedDate, instance.settings);
dates.not(this).not('#recurrence_end').datepicker("option", option, date);
}
}
var dates = jQuery("#EventStartDate, #EventEndDate, .datepicker").datepicker(datepickerOpts);
}
});
</script>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment