gpt4 book ai didi

javascript - 如何从 FullCalendar 中的事件获取弹出消息中事件的开始和结束时间?

转载 作者:行者123 更新时间:2023-12-03 01:54:59 24 4
gpt4 key购买 nike

当鼠标悬停在中的事件上时,我想将每个事件的开始结束时间显示为popover消息FullCalendar 的 >monthView

我有以下内容:

element.popover({
content: event.start,
animation: true,
delay: 300,
content: event.start + event.end,
trigger: 'hover',
placement: 'top',
container: 'body'
});

当我在 content 中有 event.startevent.end 时,我会得到date 和按以下方式正确设置时间:Wed May 09 2018 08:00:00 GMT +0000。但是,当我在 content 中有 event.start + event.end 时,我得到一个模糊的数字:3051738000000

假设start09:00:00end15:00:00。我希望消息说:

Start: 9AM
End: 3PM

我应该做什么?

最佳答案

开始日期的格式需要采用正确的方式。 Displaying format显示正确的格式。感谢@ADyson 提供的链接! (看评论)。另外,要在内容中启用 html,我们需要设置 html: true,

element.popover({
animation: true,
delay: 300,
trigger: 'hover',
placement: 'top',
html: true,
container: 'body',
content: '<p>' + 'Start: ' + event.start.format('h:mm a') + '</p><p>' + 'End: ' + event.end.format('h:mm a') + '</p>'

});

关于javascript - 如何从 FullCalendar 中的事件获取弹出消息中事件的开始和结束时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50281818/

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