如何从 FullCalendar 中的事件获取弹出消息中事件的开始和结束时间?
How to get start and end time of event in popover message from an event in FullCalendar?
当鼠标悬停在 monthView
of [=16] 中的事件上时,我想将每个事件的 start
和 end
时间显示为 popover
消息=].
我有以下内容:
element.popover({
content: event.start,
animation: true,
delay: 300,
content: event.start + event.end,
trigger: 'hover',
placement: 'top',
container: 'body'
});
当我在 content
中有 event.start
或 event.end
时,我通过以下方式正确获得 date
和 time
:Wed May 09 2018 08:00:00 GMT +0000
.但是当我在 content
中有 event.start + event.end
时,我得到一个模糊的数字:3051738000000
。
假设 start
是 09:00:00
,而 end
是 15:00:00
。我想要消息说:
Start: 9AM
End: 3PM
我该怎么办?
start
和 date
的格式需要正确。 Displaying format 显示正确的 format
。感谢@ADyson 的 link! (看评论)。此外,要在内容中启用 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>'
});
当鼠标悬停在 monthView
of [=16] 中的事件上时,我想将每个事件的 start
和 end
时间显示为 popover
消息=].
我有以下内容:
element.popover({
content: event.start,
animation: true,
delay: 300,
content: event.start + event.end,
trigger: 'hover',
placement: 'top',
container: 'body'
});
当我在 content
中有 event.start
或 event.end
时,我通过以下方式正确获得 date
和 time
:Wed May 09 2018 08:00:00 GMT +0000
.但是当我在 content
中有 event.start + event.end
时,我得到一个模糊的数字:3051738000000
。
假设 start
是 09:00:00
,而 end
是 15:00:00
。我想要消息说:
Start: 9AM
End: 3PM
我该怎么办?
start
和 date
的格式需要正确。 Displaying format 显示正确的 format
。感谢@ADyson 的 link! (看评论)。此外,要在内容中启用 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>'
});