jquery - fullcalender 在添加有效范围时跳过一个月
问题描述
我想在 fullcalender 中从当前日期跳过 10 天,它工作正常,但是当我点击下个月时,它会从 1 月直接进入 3 月并跳过 2 月。
这是导致问题的代码和行:start: nowDate.setDate(nowDate.getDate() +10
<script type="text/javascript">
// jQuery(document).ready(function($){
document.addEventListener('DOMContentLoaded', function() {
var scheduled_occasionsEl = document.getElementById('occ');
var scheduled_occasions = new FullCalendar.Calendar(scheduled_occasionsEl, {
// initialDate: '2020-09-12',
// editable: true,
selectable: true,
// businessHours: true,
dayMaxEvents: true, // allow "more" link when too many events
events: <?php echo json_encode($calendar_events)?>,
validRange: function(nowDate){
return {start: nowDate.setDate(nowDate.getDate() +10)} //to prevent anterior dates
},
});
scheduled_occasions.render();
});
// });
</script>
解决方案
我使用此处给出的文档链接https://fullcalendar.io/docs/visibleRange修复了没有时刻 js
validRange: function(nowDate){
var startDate = new Date(nowDate.valueOf());
startDate.setDate(startDate.getDate() + 10);
return {start: startDate} //to prevent anterior dates
},
推荐阅读
- github - 有没有办法使用 GitHub 操作通过 FTP 从 Windows 服务器中删除文件?
- python - Python 3.8.7 在 Windows 10 中以一种有趣的方式运行
- copy - asp 自动将数据库文件从在线复制或下载到本地电脑
- spring-boot - 没有找到端点映射 Spring-Boot
- swift - 如何使样式选择器完全可触摸
- javascript - 未捕获的异常:Highcharts 中的范围错误未解决
- javascript - Vue组件没有在项目中呈现,没有任何进一步的错误
- mysql - 如何使用 swift 检查和更新 mySQL?
- r - 将整个 data.table 传递给 j 表达式
- python - 错误:优化器得到一个空的参数列表。如何修改我的代码?