vue-cal
vue-cal copied to clipboard
Support for earliestStart and latestEnd constraints.
Support for constraints on the start and end of an event while creating or resizing it by dragging. To use the application should in its event-create handler set a constraints property on the (returned) event.
This property should be an object with:
earliestStart, optional, the earliest allowed start Date for the eventlatestEnd, optional, the latest allowed end Date for the event
For example to restrict events to a maximum length of 90 minutes the event-create handler could be like:
addEvent (ev) {
ev.constraints = {
latestEnd: ev.start.addMinutes(90)
}
return ev
}
Hi @lokkilok, thanks a lot for your contribution! I really like the idea.
Could you develop more on which constraints you think could be set? It would be great to have a min and max (dates) in the constraints to be consistent with the existing min/max options, as well as a minDuration maxDuration maybe.
If you think you can refactor a bit to handle it (and also handle dragging from bottom to top) it would be a great help to move forward the merge of the PR!
If not no problem, I'll see when I have a little more time. :)
Sorry for the late reply, didn't get notified about your comment....
I made a reservation system where users reserve, or "book", resources. So when the user starts to add a reservation we know when that resource is available: between when the previous reservation ends, and when the next reservation starts. But in addition we have more restrictions, such as having 5 minutes between reservation and a maximum duration. Hence the idea of setting such constraints explicitly, right when the event is created and dragging begins.
I'll see if I find time to add dragging from bottom to top next week....
@lokkilok Any chance your reservation system is open-source and available on Github? I also want to build a reservation system using vue-cal and would love to use your work as a foundation if possible. Thanks!