简体   繁体   中英

FullCalendar.js - 7 days only (no actual dates)

I'm setting a weekly scheduling system which is not linked to actual dates, but rather days in the week. So Monday-Sunday.

I've achieved this in FullCalendar using the following:

defaultView: 'basicWeek',
columnFormat: 'ddd',

However I now have issues displaying the events that are read from my DB, as I can only get FullCalendar to display dates that are in a standard full date format.

My options are:

1) Set an invisible date range (Eg, 2017-01-01 - 2017-01-07) and save all events within this range (invisible to the user but operational on backend)

2) Try and store the dates as Mon/Tue/Wed and load natively into FullCalendar

I'm aiming for the 2nd!

you can use the getDay() function to get the day of the week. (int)

The getDay() method returns the day of the week (from 0 to 6) for the specified date.
Note : Sunday is 0, Monday is 1, and so on. - w3schools

Example:

 var d = new Date('2017-04-26'); var n = d.getDay(); alert(n); // will be 3 => Wednesday 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM