gpt4 book ai didi

javascript - jQuery 完整日历事件标题时间错误

转载 作者:行者123 更新时间:2023-12-03 11:25:07 26 4
gpt4 key购买 nike

我的 UI 中有一个 jQuery 完整日历,它看起来如下:

enter image description here

问题在于事件标题的 10:00-10:00am 部分,该部分似乎是根据设置 UI 元素的 JSON 中的事件 startTime 和 endTime 参数添加到元素中的。请在此处查看我的代码部分:

jQuery(document).ready(function() {
jQuery('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month, agendaWeek, agendaDay'
},
allDayText: 'All Day',
columnFormat: {
month: 'ddd',
week: 'ddd d/M',
day: 'dddd d/M'
},
editable: false,
weekends: true,
timeFormat: 'h:mm-h:mma ',
axisFormat: 'hh:mma',
firstDay: 1,
slotMinutes: 15,
defaultView: 'month',
minTime: '10:00',
maxTime: '17:00',
monthNames: ["January","February","March","April","May","June","July", "August", "September", "October", "November", "December" ],
monthNamesShort: ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","nov","Dec"],
dayNames: ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
dayNamesShort: ["Sun","Mon", "Tue", "Wed", "Thus", "Fri", "Sat"],
buttonText: {
today: "Today",
day: "Day",
week:"Week",
month:"Month"
},
selectable: true,
selectHelper: false,
select: function(start, end, allDay) {

},

events: [
{
id: "3",
title: "My event title",
start: new Date(2014,10,03,10,0),
end: new Date(2014,10,03,12,0),
allDay: false,
backgroundColor : "#7F97FF",
textColor: "white"
},

问题出在 UI 中,它显示 10:00-10:00am,这没有意义。根据我的事件代码,它应该从 10,00,00 开始,到 12,00,00 结束,那么为什么标题与此不匹配呢?有人可以帮助我吗?

最佳答案

您的 FullCalendar 未正确配置,因为您希望每个事件都有“开始 - 结束”时间文本。

 timeFormat: 'h:mm-h:mma ', // the output i.e. "10:00-10:00pm"
timeFormat: 'h:mma ', // the output i.e. "10:00pm"

displayEventEnd : true, // it will show on all views (Start - End) in your timeFormat

我已经更新了您的JsFiddle ,由于您忘记插入外部源,因此我导入了 FullCalendar 库才能工作。

关于javascript - jQuery 完整日历事件标题时间错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26958022/

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