Skip to content

Instantly share code, notes, and snippets.

@JefMari
Last active February 9, 2018 06:24
Show Gist options
  • Select an option

  • Save JefMari/a525cfbac05ffbb9ab58709b6fe71f51 to your computer and use it in GitHub Desktop.

Select an option

Save JefMari/a525cfbac05ffbb9ab58709b6fe71f51 to your computer and use it in GitHub Desktop.
fullcalendar disable next and prev button depending on date
viewRender: function(currentView) {
var minDate = moment(); // Today
var maxDate = moment().add(2, 'weeks'); //Add 2 weeks for Today
var navContainer = currentView.el.parent().prev()
var disablePrev = currentView.start <= minDate;
var disableNext = currentView.end >= maxDate;
$(".fc-prev-button", navContainer).prop('disabled', disablePrev);
$(".fc-prev-button", navContainer).toggleClass('fc-state-disabled', disablePrev);
$(".fc-next-button", navContainer).prop('disabled', disableNext);
$(".fc-next-button", navContainer).toggleClass('fc-state-disabled', disableNext);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment