Skip to content

Instantly share code, notes, and snippets.

@spencerfinnell
Created May 17, 2019 15:55
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 spencerfinnell/831a11769868b7f60cbeb55b6408bd13 to your computer and use it in GitHub Desktop.
Save spencerfinnell/831a11769868b7f60cbeb55b6408bd13 to your computer and use it in GitHub Desktop.
jQuery( function( $ ) {
var start, end, nights;
$( '.simpay-date-input' ).datepicker( 'option', 'onSelect', function() {
startVal = $( '#simpay-10-date-6' ).val();
endVal = $( '#simpay-10-date-7' ).val();
if ( '' !== startVal && '' !== endVal ) {
start = new Date( startVal );
end = new Date( endVal );
nights = end.getDate() - start.getDate();
alert( 'Nights ' + nights );
// Determine further pricing based on nights.
}
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment