gpt4 book ai didi

javascript - FullCalendar 选择一个月中的某一天返回不正确的周

转载 作者:行者123 更新时间:2023-12-03 11:34:45 24 4
gpt4 key购买 nike

我在 yii 安装中实现了 fullcalendar。我使用三个选项month,agendaWeek.agendaDay问题是,当我在月份显示中并选择一天时,加载的议程周通常是实际选择的前一周。

        'dayClick' => new CJavaScriptExpression("function(date, jsEvent, view) {
var currdisplay=view.name;
if(currdisplay=='month'){
$('.calendar').fullCalendar( 'changeView', 'agendaWeek' );
}}"),

我设置的选项是

'options'=>array(
'header'=>array(
'left'=>'prev,next,today',
'center'=>'title',
'right'=> 'month,agendaWeek,agendaDay',
),
'minTime' => '09:00:00',
'maxTime' => '20:00:00',
'slotDuration' => '01:00:00',
'slotEventOverlap' => false,
'defaultTimedEventDuration' => '01:00:00',
'allDaySlot' => false,
'allDay' => false,
'lazyFetching'=>true,
'weekends' => false,
'selectable' => true,
'height' => 'auto',
)

FullClendar 版本 2.1.1

最佳答案

尝试将日期实际更改为用户在更改 View 之前单击的日期。

$('#calendar').fullCalendar({
dayClick: function(date, jsEvent, view) {
if(view.name == 'month') {
$('#calendar').fullCalendar('gotoDate', date);
$('#calendar').fullCalendar('changeView', 'agendaWeek');
}
}
...
});

关于javascript - FullCalendar 选择一个月中的某一天返回不正确的周,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26568316/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com