Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!