Catch only the time in FullCalendar

0

How do I get the time on FullCalendar only? I'm using FullCalendar to register the events. The fields are:

  

Title, Event Color, Date, Time, Description

In the database, it is being registered as follows:

OnlywhenIedit,itappearswiththewrongtime,see:

Lookatthecodeinthetimezone,Itriedtoputid="hour" , but it does not seem to be in FullCalendar:

HTML

<div class="md-input-wrapper">
      <input type="text" id="hour" name="Hora" data-mask="99:99" class="md-form-control md-static hour" placeholder="Coloque o horário inicial do evento" value="<?php echo date("H:i"); ?>" required>
      <label id="tipoEnvio">Hora:</label>
</div>

Jquery

<script src="fullcalendar/moment.min.js"></script>
<script src="fullcalendar/fullcalendar.min.js"></script>
<script src='fullcalendar/locale/pt-br.js'></script>

<script>
  $(document).ready(function() {

   var calendar = $('#calendar').fullCalendar({
     validRange: {
         start: '<?php echo date("Y-m-d"); ?>'
     },
     header: {
       left: 'prev,next today',
       center: 'title',
       right: 'month,agendaWeek,agendaDay'
     },
     defaultDate: Date(),
     navLinks: true,
     editable: true,
     eventLimit: true,
     eventClick: function(event) {
       $('#visualizar #id').text(event.id);
       $('#visualizar #id').val(event.id);
       $('#visualizar #title').text(event.title);
       $('#visualizar #title').val(event.title);
       $('#visualizar #start').text(event.start.format('DD/MM/YYYY HH:mm:ss'));
       $('#visualizar #start').val(event.start.format('DD/MM/YYYY HH:mm:ss'));
       $('#visualizar #color').val(event.color);
       $('#visualizar #description').val(event.description);
       $('#visualizar').modal('show');
       calendar.fullCalendar('refetchEvents');
       return false;
     }
....

PHP

$data = array();
....
while($listar = mysqli_fetch_array($sqlVisualizar)) {
       list($dia,$mes,$ano) = explode("/",$listar["DataAgenda"]);
      $dataEvento = $ano."-".$mes."-".$dia;
      $linhas['id'] = $listar["IdAgenda"];
      $linhas['title'] = $listar["Titulo"];
      $linhas['start'] = $listar["DataAgenda"];
      $linhas['color'] = $listar["CorAgendamento"];
      $linhas['description'] = $listar["Conteudo"];
      array_push($data,$linhas);
}
   return json_encode($data,JSON_UNESCAPED_SLASHES);

Is there a variable in FullCalendar, or is there any way to get only the time?

    
asked by anonymous 05.06.2018 / 17:00

3 answers

0

I managed to resolve. I've included these two lines:

 $('#visualizar #hour').text(event.start.format('HH:mm:ss'));
 $('#visualizar #hour').val(event.start.format('HH:mm:ss'));
    
05.06.2018 / 17:06
0

@ Fox.11 friend, how did you separate the date of the hour? and display so in this Modal? and also add that content field, can you help me do in my calendar too? Thank you in advance.

    
28.06.2018 / 02:26
0

Hello, The Lélis Designer, please forgive me the delay, only now that I have come to see your response. Follow below:

HTML

<div class="visualizar">
    <input type="text" id="start" name="Data" class="form-control" readonly style="font-weight: bold">
    <input type="text" id="hour" name="Data" class="form-control" readonly style="font-weight: bold">
</div>

JQuery

   $('#visualizar #start').val(event.start.format('DD/MM/YYYY'));
     $('#visualizar #hour').text(event.start.format('HH:mm'));

$.ajax({
url:"suapagina.php",
type:"POST",
dataType: 'JSON',
data:{start:start,id:id},

success:function(sucesso){

if(sucesso.hasEvent == false){
   $('#confirmar').modal('show');  // Modal bootstrap  
    calendar.fullCalendar('refetchEvents');
 }else{
  $('#erro').modal('show'); // Modal bootstrap
 }
}
});
    
10.10.2018 / 16:02