Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

240
Vistas
Choose year for Datepicker

Good afternoon. In my project, I need to display a calendar for a year. I did it with datepicker. Now I need to make it so that I can select the year of this calendar from another page. Please tell me how to do this? (A year comes to the page with a request)

function drawDatepicker(){
        $('#picker').datepicker({
            showOtherMonths: true,
            selectOtherMonths: true,
            numberOfMonths: [3,4],
            stepMonths: 0,
            yearRange: chouseYear + ":" + chouseYear,
            showCurrentAtPos: new Date().getMonth(),
            onSelect: function (dateText, datePicker) {
                datePicker.drawMonth += $("#picker").datepicker("option", "showCurrentAtPos");
                var radVal = $('input[name="typeDay"]:checked').val();
                if(radVal == 1){
                    addOrRemoveDate(dateText, day_off);
                }
                if(radVal == 2){
                    addOrRemoveDate(dateText, radonica);
                }
                console.log(day_off);
                console.log(radonica);
            },
            beforeShowDay: function (date) {
                var year = date.getFullYear();
                var month = padNumber(date.getMonth() + 1);
                var day = padNumber(date.getDate());
                var dateString = day + "." + month + "." + year;
                var gotDate1 = jQuery.inArray(dateString, day_off);
                if (gotDate1 >= 0) {
                    return [true, "ui-state-highlight"];
                }
                var gotDate2 = jQuery.inArray(dateString, radonica);
                if (gotDate2>=0){
                    return [true, "ui-widget-header"];
                }
                return [true, ""];
            }
        });
    }

Screen calendar

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I found this solution to the problem. I specified defaultDate 01.01 of the desired year and showCurrentAtPos to 0. If the current year is specified, then defaultDate is today, and showCurrentAtPos is the number of the month

        defaultDate: defaultDate,
        showCurrentAtPos: sCAPos,
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda