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

137
Views
I am locked zoomed out in date picker

I actually tried to restrict users to pick dates within 2 years from today in Datepicker. So now there is one issue that is coming up that when in zoom out too much (By zooming out I mean when we click on the month name it will zoom out to all months and and similarly all month to all year) this is the zooming out I am talking about

but if I zoom out to such an extent where it shows the calendar in group of a decade or a century I am not able to zoom in back or I mean not able to go back to the calendar view where I could select dates.

so is there a way to restrict users to zoom out after a level? or is there a way to fix it?

My datepicker version is Bootstrap v4.1.1

This is the code we are using

tz_today Is today's date in yyyy-mm-dd format.

endDate = new Date(new Date().setFullYear(new Date().getFullYear() + 2)); pickDate = new Date(pickDate); // in yyyy-mm-dd format

$('#Datepicker').datepicker('destroy').datepicker({

        todayHighlight: true,

        beforeShowDay: function (date) {

            $highlight = calendar_highlight_classes(highlight_dates, pickDate, date);

            return $highlight;

        }

    }).datepicker('setStartDate', new Date(tz_today))

        .datepicker('setEndDate', endDate);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Well for me MaxViewMode worked like a charm. By default, it is set as 4 but we can change it acc. to our preference

days(0) -> month(1) -> year(2) -> decade(3) -> century(4)

MaxViewMode: 2 - to limit users to go up to years view mode

my code to limit users to go only till year

$('#Datepicker').datepicker('destroy').datepicker({
    todayHighlight: true,
    endDate: endDate,
    maxViewMode: 2
});

Here is the documentation https://bootstrap-datepicker.readthedocs.io/en/latest/options.html#maxviewmode

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!