Ver Mensaje Individual
  #3 (permalink)  
Antiguo 13/01/2011, 15:26
Avatar de masterpuppet
masterpuppet
Software Craftsman
 
Fecha de Ingreso: enero-2008
Ubicación: Montevideo, Uruguay
Mensajes: 3.550
Antigüedad: 16 años, 3 meses
Puntos: 845
Respuesta: Jquery UI DatePicker, colorear fechas en el calendario

Me auto-corrijo, con objetos la comparación no va a funcionar y inArray devuelve -1 cuando no encuentra coincidencias, te lo dejo con strings

Código Javascript:
Ver original
  1. var events = ['15-1-2011', '16-1-2011', '17-1-2011', '18-1-2011'];
  2.                
  3. $('#datepicker').datepicker({
  4.    ...
  5.    beforeShowDay: function(date) {                             
  6.       var current  = date.getDate() + '-' + (date.getMonth() + 1) + '-' + date.getFullYear();                                              
  7.       return jQuery.inArray(current, events) == -1
  8.              ? [true, '']
  9.              : [true, 'css-class-to-highlight', 'tool-tip-text'];                                              
  10.    }
  11. });

desconozco si hay algún date.format('d-m-Y') en jQuery para hacerlo mas prolijo.

Saludos y disculpas por el error.

Última edición por masterpuppet; 13/01/2011 a las 15:51