我正在jQuery的完整日曆插件。我必須根據動態時區設置今天的完整日曆日期。我今天的PHP日期變量。如何從完整日曆中的PHP變量中設置今天的日期。我嘗試了gotoDate
的選項,但它不起作用。設置PHP日期爲今天的日期在jQuery全日曆
請找到下面的代碼: -
$("#calendar").fullCalendar({
gotoDate : <?php echo $startdate; ?>,
dayClick: function (date, jsEvent, view){
$(".fc-state-highlight").removeClass("fc-state-highlight");
$("td[data-date="+date.format('YYYY-MM-DD')+"]").addClass("fc-state-highlight");
},
eventRender: function(event, element, view){
if(event.start._d.getMonth() !== $("#calendar").fullCalendar("getDate")._d.getMonth()){
return false;
}
},
viewRender: function(view, element){
$(".fc-other-month").html("");
},
windowResize: function(view) {
if($(window).width() < 514){
$("#calendar").fullCalendar("changeView", "basicDay");
}else{
$("#calendar").fullCalendar("changeView", "month");
}
}
});
任何幫助將不勝感激。提前致謝。
感謝您的快速回復。我試過這個解決方案,它不工作。我試過這樣。 var date = $ .fullCalendar.moment(「2017-06-17」);然後寫這個。 gotoDate:日期。但它不起作用 –
@mohammashoaibnagori你在控制檯中遇到什麼錯誤?你是否已經從https://momentjs.com/嵌入了MomentJS庫? –
是的,包括了moment.js。我可能不會在控制檯中出錯。它不會將時間17設置爲今天的日期 –