Skip to content

Instantly share code, notes, and snippets.

@MjHead
Last active February 24, 2023 08:17
Show Gist options
  • Save MjHead/014ddfff08c78d055d5190c90d3c8ed2 to your computer and use it in GitHub Desktop.
Save MjHead/014ddfff08c78d055d5190c90d3c8ed2 to your computer and use it in GitHub Desktop.
<?php
add_action( 'wp_footer', function() {
echo '<script>
jQuery( document ).on( "jet-booking/init-field", ( $event, $field ) => {
var silent = false;
var format = $field.data( "format" ) || "YYYY-MM-DD";
$field.bind( "datepicker-change", ( event, obj ) => {
silent = ! silent;
if ( silent ) {
$field.data( "dateRangePicker" ).setEnd( moment( obj.date1 ).add( 7, "d" ).format( "YYYY-MM-DD" ) );
}
} );
} );
</script>';
}, 99 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment