max777
max777

Reputation: 143

Full calendar display wrong date end

I am using the jquery full calendar plugin, to display the workers day off. For example: User ID-2 is on holiday from 2019-01-10 to 2019-01-10.

On the calendar, the end data is always display woring. If the end is 2019-01-10, it will display it on 2019-01-09.

I upload a photo from date calendar, and the sql table.

var hossz = 0;
var valami = [];
var eventArray = [];
$.ajax({
    type: "POST",
    url: "files/get_events.php",
    dataType: "json",
    success: function(data) {
        eventArray = data;
        hossz = eventArray.szabi_id.length;
        for (i = 0; i < hossz; i++) 
        {

            valami.push({
                title: eventArray.szabi_user[i],
                backgroundColor: eventArray.user_color[i],
                start: eventArray.szabi_from[i],
                end: eventArray.szabi_to[i],
                url: '/szabi-szerkesztes/' + eventArray.szabi_id[i]
            });



        }
        $('#calendar').fullCalendar({
            events: valami,
            lang: 'hu',
            dayClick: function(event) {
                $(cell).removeClass('ui-widget-content');
                $(cell).addClass('holiday');
                $(this).css('background-color', 'green');
            },
            defaultView: 'month',
            contentHeight: 'auto',
            slotEventOverlap: false
        });
    }
});

Data displayed on calendar

Sql data image

Upvotes: 0

Views: 1279

Answers (1)

jdickel
jdickel

Reputation: 1457

If you only use the Date without Time it‘s exclusive for Fullcalendar.js. Either you use the Date and add one second or you simply add one day to the Date.

Upvotes: 1

Related Questions