How to find the day of a reset event date in fullcalnedar

I am using fullcalendar v2.0.0 in my project. I must warn you that "you cannot move this event on Sunday." while any event is dragged onto a Sunday date.

eventDrop : function(event,revertFunc)
{
   var day = event.start.day // my assumption 
   if(day == "Sunday")
   {
       alert("You can not move this event to sunday.");
       revertFunc();
   }
   else
   {
      //Here is my ajax to update DB
   }

} 

I tried on google, but I could not find out.

Tell me how to achieve this.

The code will be noticeable!

+4
source share
1 answer

You must read the docs first moment.js. And you can format the date using the following code:event.start.format("dddd");

Implementation:

eventDrop : function(event, delta, revertFunc, jsEvent, ui, view)
{
   var day = event.start.format("dddd"); // this will give you day 
   if(day == "Sunday")
   {
      alert("You can not move this event to sunday.");
      revertFunc();
   } else {
      //Here is my ajax to update DB
   }
} 

Note: you do not install the function correctly revertFunc, try the above format.

+1
source

Source: https://habr.com/ru/post/1584830/


All Articles