fullcalendar dow无效

问题描述 投票:1回答:2

我尝试了不同的设置,但似乎没有任何效果,我需要在日历上重复活动,比如所有星期日,星期二。这是我的代码:

 $('#appointment_calendar').fullCalendar({

        header: {
            left:   'prev',
            center: 'today',    
            right:  'next'
        },
        events: [{
            title:"My repeating event",
            start: '10:00', 
            end: '14:00', 

            dow: [ 1, 4 ] 
        }],
    });

尝试删除/添加tittle,start,end,range,似乎没什么用。

fullcalendar fullcalendar-3
2个回答
0
投票

我做了一些测试,看起来FullCalendar失败,dow低于版本3.4.0。

以下代码相同,但适用于FullCalendar版本。


FullCalendar 3.4.0(确定)

<!doctype html>

<html class="no-js" lang="en">

    <head>

	<link href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.css' rel='stylesheet'>

	<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
	<script src='//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js'></script>
	<script src='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js'></script>
	
    </head>
	
    <body>
	
	<main>
		
	    <div class="inner">
		<div class="full">
				
		    <h1>Events Calendar</h1>
					
		    <div id="calendar">
		    </div>
					
		    <script>
			$(document).ready(function() {
						
			// page is now ready, initialize the calendar...
							
			    $('#calendar').fullCalendar({
					
				timezone: 'local',
				firstDay: 1,
				timeFormat: 'H:mm',
										
				events: [{
											
				    title: 'All Day Event',
				    start: "2018-04-25T09:00:00",
				    dow: [3,4,5]
					
				}]
					
			    });
					
			});
	            </script>
			
		</div>
	    </div>
			
	</main>
			
    </body>
</html>

FullCalendar 3.5.0(FAIL)

<!doctype html>

<html class="no-js" lang="en">

    <head>

	<link href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.5.0/fullcalendar.min.css' rel='stylesheet'>

	<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
	<script src='//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js'></script>
	<script src='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.5.0/fullcalendar.min.js'></script>
	
    </head>
	
    <body>
	
	<main>
				
            <h1>Events Calendar</h1>
					
            <div id="calendar">
            </div>
					
            <script>
                $(document).ready(function() {

                    // page is now ready, initialize the calendar...

                    $('#calendar').fullCalendar({

                        timezone: 'local',
                        firstDay: 1,
                        timeFormat: 'H:mm',

                        events: [{

                            title: 'All Day Event',
                            start: "2018-04-04T09:00:00",
                            dow: [3,4,5]

                        }]

                    });

                });
	    </script>

        </main>
			
    </body>
</html>

jsFiddle with FullCalendar v3.4(工作)

jsFiddle with FullCalendar v3.5(失败)


0
投票

在版本4及更高版本中,您必须使用“daysOfWeek”而不是“dow”。您还应该使用“startTime”和“endTime”而不是“start”和“end”。

所以你的代码应该改为:

$('#appointment_calendar').fullCalendar({

        header: {
            left:   'prev',
            center: 'today',    
            right:  'next'
        },
        events: [{
            title:"My repeating event",
            startTime: '10:00', 
            endTime: '14:00', 

            daysOfWeek: [ 1, 4 ] 
        }],
    });
© www.soinside.com 2019 - 2024. All rights reserved.