Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for earliestStart and latestEnd constraints. #377

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

lokkilok
Copy link

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 event
  • latestEnd, 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
}

@antoniandre
Copy link
Owner

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. :)

@lokkilok
Copy link
Author

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....

@vesper8
Copy link

vesper8 commented Jul 30, 2021

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants