How To Format Date On Fullcalendar On That Way, When I Click On Event?
Solution 1:
Since fullcalendars' event start and end properties are javascript Date
objects, it is responsibility of the code that displays them to handle their formatting, they don't have a specific format by themselves.
The easiest way I found to handle dates in javascript is to use moment.js.
Formatting your date in your alert would then be something like
alert('start: ' + moment(calEvent.start).format('DD/MM/YYYYhh:mm'));
Solution 2:
Update: This answer provides a solution for version 1 of FullCalendar. From version 2 Moment.js is used by FullCalendar, and this answer is not longer valid
Moment.js is a really great library, but you could also use the formatDate()
function provided by FullCalendar if you don't want to add another dependency.
It works like this:
alert('start: ' +
$.fullCalendar.formatDate(calEvent.start, 'dd/MM/yyyy HH:mm'));
You can check out the documentation for formatDate()
here: https://fullcalendar.io/docs1/utilities/formatDate/
Solution 3:
This worked for me; var startDate =$.fullCalendar.moment(event.start).format('YYYY/MM/DD');
Solution 4:
My solution
var startFix= moment($.fullCalendar.formatDate(start, 'YYYY-MM-DD'));
Post a Comment for "How To Format Date On Fullcalendar On That Way, When I Click On Event?"