0
votes

I realise that by design it's intended that fullcalendar endDates are exclusive, but I'm looking for help to work with that given my constraints.

Data stored is simple UK date format:

YYYY-MM-DD

start: 2015-01-18

end: 2015-01-19

I'd like to keep the look of the plain all day events, rather than the timestamped style and I cant just +1 end date as what happens come the end of the month?

I've tried poking through the source js, to remove any -1 corrections in there. That works for my multiday events, but then makes one day events look like two day events.

Scenario. Users select a start date and end date (of their holidays) So that would be perhaps monday to friday. Users dont select a time, just the date. Naturally they'll select the dates they want for holiday as inclusive.

Expected behaviour.
18/1/2015 - 18/1/2015 would highlight one full day.

18/1/2015 - 19/1/2015 would highlight two full days (inclusive days)

18/1/2015 - 20/1/2015 would highlight three full days (inclusive days)

etc..etc

Actual behaviour.

18/1/2015 - 18/1/2015 will highlight one full day.

18/1/2015 - 19/1/2015 will highlight one full day (exclusive endday)

18/1/2015 - 20/1/2015 will highlight two full days (exclusive endday)

Open to suggestions, fixes, workarounds, dirty hacks. Thanks

2

2 Answers

1
votes

Thanks to slicedtoad for the hint with eventDataTransform. I just had to find the correct way to actually add 1 to the end date. For any one curious (and I'm not sure I fully understand how it works), but a one day event is still a one day event even though it appears we're add one to the end?

events:  
        {
        url: '<?php echo base_url();?>index.php/jsonfeed',
        error: function() 
              {
              alert('error');
               },
         },
eventDataTransform: function(eventData) 
        {
        eventData.end = moment(eventData.end).add(1, 'days').format();
        return eventData;
        },
0
votes

It's possible I'm misunderstanding, but here's a possible solution.

Inside of eventDataTransform (which is called for every event), add a time to each start and end date. Something like

eventDataTransform: function(eventData){
    eventData.start.startOf('day');
    eventData.start.endOf('day');
}