如何设置jquery日期选择器的开始年份和结束年份? [英] How do I set start year and end year of jquery date picker?

查看:110
本文介绍了如何设置jquery日期选择器的开始年份和结束年份?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我初始化一个类似jquery的日期选择器时

When I initialize a jquery date picker like

$( "#datepicker" ).datepicker({
    changeMonth: true,
    changeYear: true
});

显示从2000年到2020年的日期选择器.

The showing the date picker from year 2000 to year 2020.

当我进入2000年时,它是1990年的下一次显示,但是我想以任何方式对其进行自定义.

When i go to year 2000, the next time it shows from 1990, but any way I want to customize it.

如何设置适合我要求的年份和年份.

How do I set the from year and to year that will fit for my requirements.

谢谢.

推荐答案

请参见文档:该选项称为 yearRange .

See the documentation: The option is called yearRange.

控制年份下拉列表中显示的年份范围:相对于今天的年份(-nn:+ nn),相对于当前选定的年份(c-nn:c + nn),绝对的(nnnn:nnnn) ),或这些格式的组合(nnnn:-nn).请注意,此选项仅影响下拉菜单中显示的内容,使用minDate和/或maxDate选项来限制可以选择的日期.

Control the range of years displayed in the year drop-down: either relative to today's year (-nn:+nn), relative to the currently selected year (c-nn:c+nn), absolute (nnnn:nnnn), or combinations of these formats (nnnn:-nn). Note that this option only affects what appears in the drop-down, to restrict which dates may be selected use the minDate and/or maxDate options.

这篇关于如何设置jquery日期选择器的开始年份和结束年份?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆