Can I make the jQuery datepicker display more year when using the changeYear option?

余生颓废 提交于 2019-12-02 10:15:37

Use the yearRange option to increase the size of the year drop-down.

yearRange: "c-30:+0"

will allow selecting a year after 1983 in one click, and the 70's in 2 clicks.

FIDDLE

However, this isn't a good UI. When the user first clicks on the menu, it's not obvious that they can go back more than 30 years by first selecting an old year and then clicking on the menu again. You can use c-100:+0 to allow the menu to contain 100 years, hopefully this wil be enough for most users.

If I understood correctly, then yes it is possible using minDate and maxDate options. Here you can set the year that has to be shown.

changeYear: true,
minDate: '-1Y',  //decrease 1 year from current year
maxDate: '+2Y'   //increase 2 from current year

Y represent year.

This is one shortest way to reach the year soon.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!