Skip to content
Advertisement

How to make endless business hours and constraints on FullCalendar JS?

I have to create a calendar where the available and selectable hours are every day from 10:00 to 00:00.

When I’m passing this object to businessHours, eventConstraint and selectConstraint:

{
   startTime: "10:00:00",
   endTime: "00:00:00"
}

I have all the slots that are disabled. When I’m passing this one:

{
   startTime: "10:00:00",
   endTime: "23:59:59"
}

The calendar displays the right business hours, but I can’t select the slot from 23:00 to 00:00 in any days.

How can I allow select this slot while having the right business hours, or just disable every days from 00:00 to 10:00 instead of allowing 10:00 to 00:00? I didn’t find anything about disabling instead of enabling in the documentation.

I also tried an endless constraint like:

{
   startTime: "10:00"
}

But it didn’t work. Hence, the question about endless constraint.

Thanks!

Advertisement

Answer

Finally, had an answer for this!

The endTime needs to be after starTime so we can use "24:00:00" to say midnight, instead of "00:00:00"

{
   startTime: "10:00:00",
   endTime: "24:00:00"
}

So it’s not a bug, it’s a feature.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement