Search code examples
bootstrap-4fullcalendarbootstrap-datetimepicker

bootstrap-datetimepicker.min.js and fullcalendar integration throws erroneous result


https://jsfiddle.net/ryan_ramsumair/2re89wpf/15/ https://jsfiddle.net/ryan_ramsumair/2re89wpf/15/#&togetherjs=FLNS5Vadhh

The above is a working link to the full code for the issue.

I am pushing the date selected from fullcalendar with the following code

$('#startdatetime').data("DateTimePicker").date(moment(start).format('DD/MM/YYYY HH:mm'));

Its displayed in the modal with

 <div class="form-group ">
 <label for="Patient" class="col-sm-2 control-label">Start Date & Time</label>
<input type="text" class="form-control" id="startdatetime"

Strange enough , this works perfectly for any date selected from the 1st to the 13th of the month. But anything after the 13th , it does not work.

The console .log shows that the date is being fetched properly from fullcalendar

console.log(moment(start).format('YYYY-MM-DD HH:mm:ss'));

Its very strange...

I added the full working code on the jsfiddle link , if anyone can assist.


Solution

  • Have a look at this fiddle:

    I changed your startdatetime function to

       $(function() {
          $('#startdatetime').datetimepicker(
          {format:'DD/MM/YYYY HH:mm:ss'});
       });
    

    Hope that helps.