javascript - 如何将标题设置为在完整日历中仅显示月份名称
问题描述
如何将完整日历标题设置为仅显示月份名称而不是“月份名称年份名称”?
我的代码:
$('#calendar').fullCalendar({
header: {
left: 'prev',
center: 'title',
right: 'next'
},
titleFormat: {
month: 'MMMM' // Tuesday, Sep 8, 2009
},
height: 'parent'
});
使用上面的代码不起作用,它在 console.log 上显示一些 js 错误
moment.min.js?ver=2.22.2:1 Uncaught TypeError: e.toUpperCase is not a function
该消息从 moment.min.js 文件中显示。
有什么我错了吗?
解决方案
您没有定义显示月份名称的视图。检查代码
$('#calendar').fullCalendar({
header: {
left: 'prev',
center: 'title',
right: 'next'
},
// Block should be like this
views: {
week: {
titleFormat: 'MMMM',
},
month: {
titleFormat: 'MMMM',
}
},
height: 'parent'
});
有关更多信息,请查看文档。
希望它可以帮助你:)
推荐阅读
- sql - 如何将数据从一个表迁移到另一个表,table1 中的行是 table2 中的列?
- rest - WebServices 通过 ID 参数混淆或双向哈希 GET 以避免抓取数据库
- powershell - PowerShell 如何复制带有今天日期的文件
- java - jenkins 上的 Windows 代理连接不稳定
- r - 在循环中对来自多个数据帧的变量应用 Ks.test
- java - 从 Java Spring 启动应用程序到 Azure 应用程序洞察的条件详细错误日志记录
- python-3.x - Dataflow Flex Tempates 在运行“stat /opt/google/dataflow/python_template_launcher:没有这样的文件或目录”时抛出错误:未知
- javascript - 没有库的 JSON.parse(JSON.stringify(ngrx-object)) 的更好解决方案
- html - 是否可以在第二列开始第一行并在 flex-box 中以第三列结束?
- javascript - React hooks:将组件调用为函数与渲染为元素