I want to display the start
and end
times from each event as a popover
message when the mouse hovers over the event in monthView
of FullCalendar
.
I have the following:
element.popover({
content: event.start,
animation: true,
delay: 300,
content: event.start + event.end,
trigger: 'hover',
placement: 'top',
container: 'body'
});
When I have either event.start
or event.end
in content
, I get the date
and time
correctly in the following way: Wed May 09 2018 08:00:00 GMT +0000
. But when I have event.start + event.end
in content
, I am getting a vague number: 3051738000000
.
Say if start
is 09:00:00
, and end
is 15:00:00
. I want the message to say:
Start: 9AM
End: 3PM
What should I do?
Format for start
and date
needs to be in the correct manner. Displaying format shows the correct format
. Thank you @ADyson for the link! (see comments). Also, to enable html
in the content, we need to set 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>'
});