I am trying to make a calendar feature in which a user can block off multiple date ranges by just selecting the start and end dates. I was thinking of using FullCalendar but I am not sure how to proceed with this.
I did see some examples of how to block some dates from being selected by adding my check on dayClick
but these do not deal with date ranges. I would appreciate any help, I am not really looking for an entire source but some suggestions on how to go about this.
Detect when the user clicks on dates or times. Give the user the ability to select multiple dates or time slots with their mouse or touch device. Allows a user to highlight multiple days or timeslots by clicking and dragging.
Calendar::getDate Returns a Date for the current date of the calendar. For month view, it will always be some time between the first and last day of the month.
The calendar's dates can change any time the user does the following: click the prev/next buttons, change the view, click a navlink. The dates can also change when the current-date is manipulated via the API, such as when gotoDate is called. datesSet is called after the new date range has been rendered.
eventRender is a great way to attach effects to event elements, such as a Tooltip. js tooltip effect: var calendar = new Calendar(calendarEl, { events: [ { title: 'My Event', start: '2010-01-01', description: 'This is a cool event' } // more events here ], eventRender: function(info) { var tooltip = new Tooltip(info.
This is a multi-part problem. Here's the basic idea.
selectable: true
select
callback, add a background event with addEventSource
.block: true
.selectOverlap
that returns false if event.block.Something like this JSFiddle.
selectable: true,
select: function (start, end, jsEvent, view) {
$("#calendar").fullCalendar('addEventSource', [{
start: start,
end: end,
rendering: 'background',
block: true,
}, ]);
$("#calendar").fullCalendar("unselect");
},
selectOverlap: function(event) {
return ! event.block;
}
Background events are optional, but this is usually desired (visually).
If dragging and dropping already created events is desired, you can use the selectOverlap
function in eventOverlap
as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With