Kingsley Simon
Kingsley Simon

Reputation: 2210

Fullcalendar Angular: Add an Event based on Day of the Week.

Being quite new to fullcalendar. I have my event that creates a new event for me based on Start Date and End Date.

I want to create an event based on day of the week. So e.g event 1 shud be on Monday and event 2 should be on Tuesday.

Is it possible to be done in FullCalendar Angular.

So for example how do i add this event to Monday

{
        title: 'Birthday Party',
        start: new Date(y, m, d + 1, 19, 0),
        end: new Date(y, m, d + 1, 22, 30),
        allDay: false}

Any help appreciated.

Upvotes: 1

Views: 1309

Answers (1)

luchaos
luchaos

Reputation: 1491

Use moment.js for convenience (comes with fullcalendar)

Example: Event on next monday

{
    title: 'Birthday Party',
    start: moment().day(1).hours(19).minutes(0).format(),
    end: moment().day(1).hours(22).minutes(30).format(),
    allDay: false
}

Note: Usually, moment.js comes in handy for several other date related tasks, too: converting timezones, getting timestamps, localized formatting, etc.

Upvotes: 1

Related Questions