Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/02/2012, 18:13
Avatar de Naahuel
Naahuel
 
Fecha de Ingreso: marzo-2011
Ubicación: localhost
Mensajes: 796
Antigüedad: 13 años, 1 mes
Puntos: 192
Respuesta: Rango de meses con jqueryui

Y con algo de prueba y error se podría lograr usando los parámetros minDate y maxDate. Ejemplo:

Código HTML:
Ver original
  1. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js"></script>
  2.     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
  3.     <link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css">
  4. <script type="text/javascript">
  5. $(function() {
  6.     $('.date-picker-1').datepicker( {
  7.         changeMonth: true,
  8.         changeYear: true,
  9.         showButtonPanel: true,
  10.         dateFormat: 'MM yy',
  11.         onClose: function(dateText, inst) {
  12.             var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
  13.             var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
  14.             $(this).datepicker('setDate', new Date(year, month, 1));
  15.         },
  16.         //limitar entre dos fechas. Junio del 79 y enero del 88 {el dia es 1, porque no importa}
  17.         minDate: new Date(79,5,01),
  18.         maxDate: new Date(88,1,01),
  19.     });
  20.     $('.date-picker-2').datepicker( {
  21.         changeMonth: true,
  22.         changeYear: true,
  23.         showButtonPanel: true,
  24.         dateFormat: 'MM yy',
  25.         onClose: function(dateText, inst) {
  26.             var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
  27.             var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
  28.             $(this).datepicker('setDate', new Date(year, month, 1));
  29.         },
  30.         //limitar entre un mes antes y un mes después al actual
  31.         minDate: '-1M',
  32.         maxDate: '+1M',
  33.     });
  34. });
  35. .ui-datepicker-calendar {
  36.     display: none;
  37.     }
  38. </head>
  39.     <label for="startDate">Date :</label>
  40.     <input name="startDate" id="startDate" class="date-picker-1" />
  41.     <input name="startDate" id="startDate" class="date-picker-2" />
  42. </body>
  43. </html>

Más info: http://jqueryui.com/demos/datepicker/#option-minDate
__________________
nahueljose.com.ar