gpt4 book ai didi

javascript - 在 fullcalendar.io 中仅显示当月的日期和事件

转载 作者:行者123 更新时间:2023-11-30 16:12:08 27 4
gpt4 key购买 nike

在 fullcalendar.io 的“月份” View 中,我想显示仅当前月份,以及当前月份的事件。但是,目前显示的是从当前日期算起的一个月。

E.g: If today's date was 2016-20-03...
- What fullcalendar display: From: 2016-20-03 To: 2016-19-04
- What I would like to display: From 2016-01-03 To: 2016-31-03

阅读文档并四处查找后,我找不到任何变量或设置 fullcalendar 来实现这一点,所以我认为我将不得不修改 fullcalendar.js

有人做过吗?

查看

$('#' + engineerId).fullCalendar({
header: false,
views: {
plainMonth: {
type: 'basic',
duration: { days: 31 },
buttonText: 'Month'
},
plainWeek: {
type: 'basic',
duration: { days: 7 },
buttonText: 'Week'
}
},
firstDay: 1,
dayNamesShort: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
defaultView: 'plainWeek',
theme: true,
viewRender: function (view, element) {
$('#CalendarViewObject').val(view.name);
viewName = view.name;
},
aspectRatio: ratio,
editable: true,
eventLimit: false, // allow "more" link when too many events
events: {
startEditable: false,
durationEditable: false,
url: window.location.href.toString().split(window.location.host)[1] + '/GetEmployeeEvents',
type: 'POST',
data: function () { // a function that returns an object
$("[id^=qtip-]").empty();
$("[id^=qtip-]").remove();
return {
serviceAreaId: serviceAreaId,
employeeId: engineerId,
calendarViewObject: $('#CalendarViewObject').val()
};
},
error: function () {
alert('there was an error while fetching events!');
}
},...

Controller

public JsonResult GetEmployeeEvents(DateTime start, DateTime end, string queueName, string employeeId, string calendarViewObject)

“开始”和“结束”日期由 fullcalendar.io 设置,这些日期是我想要更改的日期。

非常感谢您,阿尔维昆

最佳答案

在对 fullcalendar 文档进行更多研究后,我最终设置了以下内容:

$(\'.calendarClass\').fullCalendar(\'gotoDate\',new Date(y, m, 1));

这成功了!

关于javascript - 在 fullcalendar.io 中仅显示当月的日期和事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36084586/

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