Disable future dates after today in Jquery Ui Datepicker

后端 未结 8 1040
旧巷少年郎
旧巷少年郎 2020-12-03 10:25

I want to disable all the future dates after today in Jquery Ui Datepicker

Here is the Demo :

Code :

$( \"         


        
相关标签:
8条回答
  • 2020-12-03 10:25

    Change maxDate to current date

    maxDate: new Date()
    

    It will set current date as maximum value.

    0 讨论(0)
  • 2020-12-03 10:26

    In case you are appending Dtpicker,use the following code

    $('#enddate').appendDtpicker({
        "dateOnly": true,
        "dateFormat": "YYYY-MM-DD",
        "closeOnSelected": true,
        maxDate: new Date()         
    });
    
    0 讨论(0)
  • 2020-12-03 10:27
    maxDate: new Date() 
    

    its working fine for me disable with current date in date range picker

    0 讨论(0)
  • 2020-12-03 10:31

    In my case, I have given this attribute to the input tag

    data-date-start-date="0d" data-date-end-date="0d"

    0 讨论(0)
  • 2020-12-03 10:32

    datepicker doesnot have a maxDate as an option.I used this endDate option.It worked well.

    > $('.demo-calendar-default').datepicker({
    >                 autoHide: true,
    >                 zIndex: 2048,
    >                 format: 'dd/mm/yyyy',
    >                 endDate: new Date()
    >             });
    
    0 讨论(0)
  • 2020-12-03 10:35

    This worked for me endDate: "today"

      $('#datepicker').datepicker({
            format: "dd/mm/yyyy",
            autoclose: true,
            orientation: "top",
            endDate: "today"
    
      });
    

    SOURCE

    0 讨论(0)
提交回复
热议问题