philippfrenzel / yii2fullcalendar

JQuery Fullcalendar Yii2 Extension
GNU General Public License v2.0
133 stars 97 forks source link

Wrong time #52

Closed nagaokashi closed 8 years ago

nagaokashi commented 8 years ago

image

I don't know why the minute of start and end time on tooltip are different from calendar's time. On the tooltip, the minute is always "05". Please help me to get correct value of minute (1:00 - 2:30).

This is code of fullcalendar widget:

<?= \yii2fullcalendar\yii2fullcalendar::widget(array(
            'options' => [
            ],
            'clientOptions' => [
                'allDaySlot' => false,
                'selectHelper' => true,
                'eventClick' => new JsExpression($JSEventClick),
                'dayClick' => new JsExpression($JSDayClick),
                'eventMouseover' =>new JsExpression($JSDayMouseover),
                'eventMouseout' =>new JsExpression($JSDayMouseout),
                'defaultView' => 'agendaWeek',
                'header' => [
                    'center'=>'prev,next today',
    //                'left'=>'title',
                    'left'=>'',
                    'right'=>'agendaDay,agendaWeek,month',
                ],
            ],
            //'events'=> $events,   // Dung khi goi action index
           'ajaxEvents' => Url::to(['/datsan/jsoncalendar', 'id_sanCon' => $modelSanCon->id])
        ));
        ?>

This is code for tooltip:

$JSDayMouseover = <<<EOF
    function(calEvent, jsEvent, view) {
       var tooltip = '<div class="fullcalendar-tooltipevent">'
                        + '<h3>'+calEvent.title+'</h3>'
                        + '<p>'
                        + calEvent.start.format("DD/MM/Y") + ': ' + calEvent.start.format("HH:MM") + ' - ' + calEvent.end.format("HH:MM")
                        + '</p>'
                        + '</div>';
        $("body").append(tooltip);
        $(this).mouseover(function(e) {
            $(this).css('z-index', 10000);
            $('.fullcalendar-tooltipevent').fadeIn('500');
            $('.fullcalendar-tooltipevent').fadeTo('10', 1.9);
        }).mousemove(function(e) {
            $('.fullcalendar-tooltipevent').css('top', e.pageY + 10);
            $('.fullcalendar-tooltipevent').css('left', e.pageX + 20);
    });
    }
EOF;
nagaokashi commented 8 years ago

I made a bug in format. Fix as below. + calEvent.start.format("DD/MM/Y") + ': ' + calEvent.start.format("HH:mm") + ' - ' + calEvent.end.format("HH:mm")

philippfrenzel commented 8 years ago

Thanks!