bootstrap Datepicker:将值设置为该月的最后一天不起作用 [英] bootstrap Datepicker : set value as last day of the month not working

查看:239
本文介绍了bootstrap Datepicker:将值设置为该月的最后一天不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在月份模式下有一个引导日期选择器.我需要将该值设置为该月的最后一天. 如何使此代码起作用?

I have a bootstrap datepicker on months mode. I need the value to be last day of the month. How do I make this code work?

  $("#end-date").datepicker({
            minViewMode: 1,

    }).on('changeMonth',function(e)
        {                               
            //value of the end month is the last day of month       
            alert( new Date(e.date.getYear(), e.date.getMonth() + 1, 0));
              $("#end-date-catalog").datepicker('update', new Date(e.date.getYear(), e.date.getMonth() + 1, 0));
        });

插件演示(此处)

plugin demo (here) jsfiddle (here)

推荐答案

我进入了datePicker的js源代码,并通过在设置该值之后放置trigger(changeMonth)来解决它.

I went into the js source code of the datePicker and I solved it by putting the trigger(changeMonth) after setting the value .

这篇关于bootstrap Datepicker:将值设置为该月的最后一天不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆