我正在为我的应用程序使用完整的日历api,我正在尝试禁用fullcalendar中的过去日期,但我得到$.fullCalendar.formatDate
不是函数错误。我发布了我的代码
select : function(start, end, allDay) {
$('#clickedDateHolder').val(start.format());
// show modal dialog
var check = $.fullCalendar.formatDate(start,'yyyy-MM-dd');
var today = $.fullCalendar.formatDate(new Date(),'yyyy-MM-dd');
if(check < today)
{
bootbox.alert("Past Dates")
}else{
input.push(date.format());
$('#selectedDate').val(input);
$('#event-modal').modal('show');
所以在这段代码中,我试图在fullcalendar中查看哪个日期是过去的日期,并尝试给出一条消息,但每次我都收到此错误。有人请帮忙
答案 0 :(得分:6)
FullCalendar的formatDate()仅适用于2.0以下的版本。见这里:http://fullcalendar.io/wiki/Upgrading-to-v2/
$。fullCalendar.formatDate→使用片刻的.format()方法
所以而不是
$.fullCalendar.formatDate(start,'yyyy-MM-dd');
你必须使用
moment(start, 'DD.MM.YYYY').format('YYYY-MM-DD')
而'DD.MM.YYYY'
是start
的最新格式,format('YYYY-MM-DD')
指定目标格式。注意,你需要使用大写字母。
答案 1 :(得分:0)
您的脚本可能与其他一些脚本冲突,请尝试在其中添加所有代码而不是$(document).ready()
jQuery.noConflict();
(function( $ ) {
$(function() {
// your code
});
})(jQuery);