iqra iqra - 3 months ago 14
Javascript Question

how to get day of the selected date in fullcalender

how to get day of the selected date in fullcalender.I am working on fullcalender js and i want to get the day of the selected date ...i have tried using the day of the selected date using date.getDay();
but this isnt working...this is what i have done till now...

dayClick: function(date,jsEvent, view) {
var date=date.format('MM/DD/YYYY');
alert(date);
}


this is working now i want to show the day-name of the selected date...how should i do that...kindly help

Answer

dayClick callback accepts date as the first parameter which holds Moment for the clicked day. So to get the day name, use date.format('dddd');

dayClick: function(date){
  console.log(date.format('dddd')); //Gives the day here e.g: 'Tuesday'
}

Refer: MomentJs

Comments