jquery 禁用下1个月MonthPicker

wbrvyc0a  于 2022-11-29  发布在  jQuery
关注(0)|答案(1)|浏览(140)

我需要禁用到下一个月。请帮助我

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

我代码如下所示

cdmah0mi

cdmah0mi1#

要将日期推迟整整一个月,您可以执行以下操作:

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

console.log(date);

或者将其 Package 到一个函数中,以使用elswhere,如this answer(答案的源代码)

相关问题