Skip to content

Instantly share code, notes, and snippets.

@alex-authlab
Created March 9, 2021 04:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-authlab/83720081eb0cb914e3e05772610c33eb to your computer and use it in GitHub Desktop.
Save alex-authlab/83720081eb0cb914e3e05772610c33eb to your computer and use it in GitHub Desktop.
flatpicker set check in date < check out date
// booking date check in > check out
$( document ).ready(function() {
var check_in = flatpickr(".in-date",{dateFormat: "d/m/Y",});
var check_out = flatpickr(".out-date",{dateFormat: "d/m/Y",});
check_in.element.addEventListener("change", function(){
check_out.set( "minDate" , check_in.element.value );
});
check_out.element.addEventListener("change", function(){
check_in.set( "maxDate" , check_out.element.value );
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment