简体   繁体   English

minDate不在datetimepicker库上工作

[英]minDate not working on datetimepicker library

I use the datetimepicker plugin for datepicker. 我为datepicker使用datetimepicker插件。 I want to hide past date from today But mindate not working. 我想隐藏今天的过去日期但是请注意不要工作。 I use like this: 我用这样的:

$('.datetimepicker7').datetimepicker({
   onChangeDateTime:logic,
   onShow:logic,
   format:'d/m/Y',
   formatDate:'d/m/Y',
   timepicker:false,
   minDate: +1, // here i use minDate but this is not working
   theme:'dark'
});

See image past date is visible on the datepicker box: 在datepicker框中可以看到图像过去日期:

在此输入图像描述

Here I fixed the problem by using: 在这里我通过使用:

var tday = new Date();

$('.datetimepicker7').datetimepicker({
  onChangeDateTime:logic,
  onShow:logic,
  format:'d/m/Y',
  formatDate:'d/m/Y',
  timepicker:false,
  minDate: tday,
  theme:'dark'
});

Please try with below solution: 请尝试以下解决方案:

var setMin = function( currentDateTime ){
  this.setOptions({
      minDate:'-1970/01/02'
  });
  this.setOptions({
      minTime:'11:00'
  });
};

$('.datetimepicker7').datetimepicker({
    onShow:setMin,
 onChangeDateTime:logic,
  format:'d/m/Y',
  formatDate:'d/m/Y',
  timepicker:false,
  theme:'dark'
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM