Home > Blockchain >  NET MVC Fullcalendar V5 events not displaying in calendar
NET MVC Fullcalendar V5 events not displaying in calendar

Time:08-20

I am developing fullcalendar for MVC Project. I tried everything json return no problem it works but events not showing in calendar.

Use

JavaScript: FullCalendar v5

MVC 5: Entity Framework

Please check Javascript Code

      events: function (fetchInfo, successCallback, failureCallback) {
            jQuery.ajax({
                url: "GetEvents",
                type: "GET",
                dataType: 'json',
                success: function (data) {
                    var events = [];
                    $.each(data, function (i, v) {
                        events.push({
                            id: v.id,
                            title: v.title,
                            start: moment(v.start).format('DD/MM/YYYY')
                        });
                    });
                    console.log(events);
                    successCallback(events);
                }
            });
        }
    });
    calendar.render();

Please check also CONTROLLER Json Code

      public JsonResult GetEvents()
      {
        using (var db = new Entities())
        {
            var events = db.NobEczanes.Include(x => x.Eczane).Select(asset => new
            {
                id = asset.EventID,
                title = asset.Eczane != null ? asset.Eczane.Ad : "",
                start = asset.Tarih
            }).ToList();

            return new JsonResult { Data = events, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
        }
    }

Please check Chrome Console Debugger Log

Console Log

UPDATE: CONSOLE LOG DETAILS! Please Check Image Links Thanks!

First Screen for Console Log

Second Screen for Console Log

Three Screen for Console Log

Full Detail Console Log

Visual Studio Breakpoint Result

Database Screen

Last Update Javascript Code and Effect start value but still same problem

$.each(data, function (i, v) {
      debugger;
      events.push({
        id: v.id,
        title: v.title,
        start: moment(v.start).format('DD/MM/YYYY')
});

Check Last Console Log

CodePudding user response:

Here issue depend via Date Format

Solution!

start: moment(data.start).format("YYYY-MM-DD") 

It work fine thanks.

  • Related