How can i set Year range for a jQuery Date Picker: 1900 to current year, or 1900 to 9999

后端 未结 6 2016
囚心锁ツ
囚心锁ツ 2021-02-05 10:59

Hi all i used the Jquery Date picker which works well enough for me. But i am having a small issue i.e i would like to set the Start year from 19

相关标签:
6条回答
  • 2021-02-05 11:30

    try this:

    datepick({yearRange: '1900:' + new Date().getFullYear()});
    
    0 讨论(0)
  • 2021-02-05 11:41

    This is what you need:

    datepick({yearRange: "1900:+nn"});
    

    Will set the range from the 1900 to the current year.

    0 讨论(0)
  • 2021-02-05 11:42
    $("#textBox").datepicker({
        changeMonth: true, changeYear: true, yearRange: '1900:+0'
    });
    
    0 讨论(0)
  • 2021-02-05 11:43

    you can set specific year of difference from current year

        $( "#datepicker" ).datepicker({ 
            changeYear: true,
             minDate: '-116Y',
             maxDate: '1Y', 
             yearRange: '-116',
         });
    
    0 讨论(0)
  • 2021-02-05 11:45

    $("#date").datepicker({ changeYear:true, yearRange: "1900:1999" });

    0 讨论(0)
  • 2021-02-05 11:53

    You can use the following.

     $("#datepicker").datepicker({
         changeMonth: true, // this will help you to change month as you like
         changeYear: true, // this will help you to change years as you like
         yearRange: "1900:9999"
     });
    
    0 讨论(0)
提交回复
热议问题