Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jonahcoyote
Forked from jo-snips/community-datepicker.js
Created February 22, 2016 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonahcoyote/8a666dbd0d7afb26e84b to your computer and use it in GitHub Desktop.
Save jonahcoyote/8a666dbd0d7afb26e84b to your computer and use it in GitHub Desktop.
// Customize Events Community Datepicker
if($("div.tribe-community-events-date input.datepicker").length) {
var datepickerOpts = {
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true,
onSelect: function(selectedDate) {
var option = this.id == "EventStartDate" ? "minDate" : "maxDate";
var instance = $(this).data("datepicker");
var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
dates.not(this).not('#recurrence_end').datepicker("option", option, date);
}
}
var dates = $("div.tribe-community-events-date input.custom-datepicker").datepicker(datepickerOpts);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment