Baba Ranjith
Baba Ranjith

Reputation: 179

Disable next 1 month MonthPicker

I need to disable till Next 1 month. please help me out

$(".input-monthpicker-freezelastyear").datepicker({
        format: "mm-yyyy",
        viewMode: "months",
        minViewMode: "months",
        startDate: new Date(),
        autoclose: true
    });


my code look like this

Upvotes: 1

Views: 63

Answers (1)

Harrison
Harrison

Reputation: 2347

To push the date by 1 whole month you could do something like this:

// Get Date now
const date = new Date()
// Set the month exactly one more from now
date.setMonth(date.getMonth()+1)

console.log(date);

Or wrap it into a function to use elswhere like this answer (answer's source)

Upvotes: 2

Related Questions