Home > Web Front-end > JS Tutorial > How to Create Recurring Events with Specific Ranges in FullCalendar?

How to Create Recurring Events with Specific Ranges in FullCalendar?

Linda Hamilton
Release: 2024-11-11 03:19:02
Original
244 people have browsed it

How to Create Recurring Events with Specific Ranges in FullCalendar?

Recurring Events in FullCalendar

When scheduling appointments or availability in a calendar, it's common to need events that recur on specific days. FullCalendar provides options to handle recurring events, including daily repetitions.

Daily Recurring Events

To create a daily recurring event, specify the days of the week using the dow property. For example, the following event recurs only on Mondays from 7:00 AM to 9:00 AM:

{
  title: "Morning Appointment",
  start: "07:00",
  end: "09:00",
  dow: [1] // Repeat on Mondays
}
Copy after login

Weekly Recurring Events with Restrictions

If you want the recurring events to have specific start and end dates, you can use the ranges property. Each range represents a period when the event should be active. For instance, the following event recurs every Monday and Thursday during March, May, and the entire year of 2017:

{
  id: 1,
  start: "10:00",
  end: "12:00",
  dow: [1, 4],
  ranges: [
    {
      start: "2015/03/01",
      end: "2015/04/01"
    },
    {
      start: "2015/05/01",
      end: "2015/06/01"
    },
    {
      start: "2016/01/01",
      end: "2017/01/01"
    }
  ]
}
Copy after login

The eventRender callback can be used to filter out any events that fall outside of the specified ranges.

Overnight Recurring Events

FullCalendar supports overnight events. Simply specify an end time that goes beyond 24:00. For example, the following event recurs every Tuesday from 10:00 PM to 3:00 AM the next day:

{
  title: "Overnight Event",
  start: "22:00",
  end: "03:00",
  dow: [2]
}
Copy after login

The above is the detailed content of How to Create Recurring Events with Specific Ranges in FullCalendar?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template