JavaScript - datetime picker jquery

 
Vista:
Imágen de perfil de maximiliano
Val: 4
Ha disminuido su posición en 34 puestos en JavaScript (en relación al último mes)
Gráfica de JavaScript

datetime picker jquery

Publicado por maximiliano (2 intervenciones) el 16/07/2019 00:49:14
Hola a todos,
Estoy intentando implementar un jQuery datetime picker, utilizando la librería de https://xdsoft.net/jqplugins/datetimepicker/. El calendario ya está funcionando pero necesito insertar un código dentro del actual y no sé dónde, realmente no uso este idioma.

El calendario que ya funciona.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<script>
$(function(){
    $("#datetimepicker").datetimepicker({
    onGenerate:function( ct ){
jQuery(this).find('.xdsoft_date.xdsoft_weekend')
},
    minDate: (0),
    dayOfWeekStart: (1),
    timepicker:true,
    disabledWeekDays: [0,<?php echo $res['day1']; ?>,<?php echo $res['day2']; ?>,<?php echo $res['day3']; ?>,<?php echo $res['day4']; ?>,<?php echo $res['day5']; ?>,<?php echo $res['day6']; ?>],
    disabledDates: ['<?php echo $res['date']; ?>'],
    formatDate:'Y-m-d',
    dateFormat: 'Y-m-d H:i',
    inline:true,
    minTime: '8:00',
    maxTime: '21:00',
    step: (60),
});
 
</script>


La parte que necesito insertar, supongo que si hago un cal con <php> aquí "if (currentDateTime.getDay () == 6)" desde la base de datos, podré hacer algunos echo aquí "this.setOptions ({"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var logic = function( currentDateTime ){
  // 'this' is jquery object datetimepicker
  if( currentDateTime.getDay()==6 ){
    this.setOptions({
      minTime:'11:00'
    });
  }else
    this.setOptions({
      minTime:'8:00'
    });
};
jQuery('#datetimepicker_rantime').datetimepicker({
  onChangeDateTime:logic,
  onShow:logic
});
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de max
Val: 4
Ha disminuido su posición en 34 puestos en JavaScript (en relación al último mes)
Gráfica de JavaScript

datetime picker jquery

Publicado por max (2 intervenciones) el 16/07/2019 08:03:56
ahí esta por si a alguien le sirve, busca por fechas y arroja horas. saludos.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
jQuery.datetimepicker.setLocale('es');
var logic = function( currentDateTime ){
    if( currentDateTime.Date==['2019-07-24']){
        this.setOptions({
            allowTimes:['11:00','12:00']
        });
    }else
    this.setOptions({
        allowTimes:['8:00','9:00','10:00']
    });
};
jQuery('#datetimepicker').datetimepicker({
    onChangeDateTime:logic,
    onShow:logic,
    inline: true,
    minDate: (0),
    dayOfWeekStart: (1),
    timepicker:true,
    disabledWeekDays: [0,<?php echo $reserva['lunes']; ?>,<?php echo $reserva['martes']; ?>,<?php echo $reserva['miercoles']; ?>,<?php echo $reserva['jueves']; ?>,<?php echo $reserva['viernes']; ?>,<?php echo $reserva['sabado']; ?>],
    disabledDates: ['2019-07-23'],
    formatDate:'Y-m-d',
    format: 'Y-m-d H:i',
    formatTime: 'H:i',
    minTime: '8:00',
    maxTime: '21:00',
    step: (60),
    allowBlank: false,
});
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar