Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

239
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda