Skip to content

Instantly share code, notes, and snippets.

@AndreaBarghigiani
Last active February 26, 2017 16:41
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 AndreaBarghigiani/abe938661df6c9a2dcdc71daeb5c14b0 to your computer and use it in GitHub Desktop.
Save AndreaBarghigiani/abe938661df6c9a2dcdc71daeb5c14b0 to your computer and use it in GitHub Desktop.
jQuery(function() {
// Check the date range, 86400000 is the number of milliseconds in one day
$("#start_date").datepicker({
dateFormat: "dd/mm/yy",
changeMonth: true,
changeYear: true,
onSelect: function(selected) {
$("#end_date").datepicker("option","minDate", selected)
}
});
$("#end_date").datepicker({
dateFormat: "dd/mm/yy",
changeMonth: true,
changeYear: true,
minDate: $("#start_date").val(),
onSelect: function(selected) {
$("#start_date").datepicker("option","maxDate", selected)
}
});
});
$(function() {
// Check the date range, 86400000 is the number of milliseconds in one day
$("#start_date").datepicker({
dateFormat: "dd/mm/yy",
changeMonth: true,
changeYear: true,
onSelect: function(selected) {
$("#end_date").datepicker("option","minDate", selected)
}
});
$("#end_date").datepicker({
dateFormat: "dd/mm/yy",
changeMonth: true,
changeYear: true,
minDate: $("#start_date").val(),
onSelect: function(selected) {
$("#start_date").datepicker("option","maxDate", selected)
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment