Skip to content

Instantly share code, notes, and snippets.

@olimortimer
Created May 25, 2012 09:58
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 olimortimer/2787075 to your computer and use it in GitHub Desktop.
Save olimortimer/2787075 to your computer and use it in GitHub Desktop.
JS: jQuery to / from datepickers
$(function() {
// Set each date picker with a min / max date of what was chosen in the other
$("#date_from").datepicker({
dateFormat: "dd/mm/yy",
onClose: function(dateValue, inst) {
$("#date_to").datepicker("option", "minDate", dateValue);
}
});
$("#date_to").datepicker({
dateFormat: "dd/mm/yy",
onClose: function(dateValue, inst) {
$("#date_from").datepicker("option", "maxDate", dateValue);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment