Maison  >  Questions et réponses  >  le corps du texte

javascript - mobiscrol日期的限制,比如只可以选择5天内的时间,求大佬探索一下

我用了这个mobiscrol 插件,
但是我想限制一下日期,比如我只让他可以选择5天以内的时间。其他的不能选择、
我看了源码,看的不是很明白,想找一个大佬一起探索下,谢谢了

迷茫迷茫2720 Il y a quelques jours674

répondre à tous(1)je répondrai

  • 迷茫

    迷茫2017-04-11 10:31:48

    var now = new Date(),
    max = new Date(now.getFullYear(), now.getMonth(), now.getDate()+5),
    min=new Date(now.getFullYear(), now.getMonth(), now.getDate());
            
            $('#demo').mobiscroll().datetime({
                theme: 'mobiscroll',
                display: 'bottom',
                lang: 'zh', 
                min:min , 
                max: max,
                headerText:'出发时间',
                dateWheels: '|d|',
                timeWheels: 'HHii' ,
                dateFormat: 'yyyy-mm-dd'
            });

    répondre
    0
  • Annulerrépondre