Skip to content

Instantly share code, notes, and snippets.

@sporkman
Created December 1, 2020 21:13
Show Gist options
  • Save sporkman/c72e2307dd9866b869f7813798e2e5ef to your computer and use it in GitHub Desktop.
Save sporkman/c72e2307dd9866b869f7813798e2e5ef to your computer and use it in GitHub Desktop.
<script>
// For date/time picker +1 day after certain time
// https://gist.github.com/carmoreira/3ebf05aa9e31f8ddba3af8e3408ceab6 (plugin author)
jQuery(document).ready(function(){
// get current time with moment - it will have the tz
var date = moment().toDate();
var closetime = moment('18:00','HH:mm').toDate();
// if it's after X pm (24 hr format) then change classes and re-init date pickers
if(date >= closetime){
jQuery('.datefield-ny').removeClass('datefield-ny').addClass('datefield-ny-plus-one');
dtp_init_pro();
}
if(date >= closetime){
jQuery('.datefield-virtual').removeClass('datefield-virtual').addClass('datefield-virtual-plus-one');
dtp_init_pro();
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment