jquery ui 日期选择器。我如何显示所有可能的年份(生日)?

发布于 2024-12-15 12:31:15 字数 347 浏览 7 评论 0原文

我正在使用 jquery ui datepicker 和changeYear。 问题是它以块的形式显示年份(从 1985 年到 2005 年,然后单击 1985 年打开其他年份)我需要显示我经过的范围内的所有年份,如下所示:

$(".datepickerBDAY_trigger").datepicker({
    "dateFormat": "yy-mm-dd",
    changeMonth: true,
    changeYear: true,
    maxDate: "-16Y",
    minDate: "-100Y"
});

我该怎么做?我在其他地方找不到此信息。

谢谢

I'm using jquery ui datepicker with changeYear.
The problem is that it shows the years in chunks (from 1985 to 2005, then clicking on 1985 opens other years) I need to show ALL the years in the range I'm passing like this:

$(".datepickerBDAY_trigger").datepicker({
    "dateFormat": "yy-mm-dd",
    changeMonth: true,
    changeYear: true,
    maxDate: "-16Y",
    minDate: "-100Y"
});

How can I do this? I cannot find this information anywhere else.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扛起拖把扫天下 2024-12-22 12:31:15

您可以使用 yearRange 选项。它的第一种形式 (-nn:+nn) 允许您指定相对于当前年份而不是当前选定年份的范围。

$(".datepickerBDAY_trigger").datepicker({
    dateFormat: "yy-mm-dd",
    changeMonth: true,
    changeYear: true,
    maxDate: "-16Y",
    minDate: "-100Y",
    yearRange: "-100:-16"
});

您可以在这个小提琴中查看结果。

You can use the yearRange option. Its first form (-nn:+nn) allows you to specify a range relative to the current year instead of the currently selected year.

$(".datepickerBDAY_trigger").datepicker({
    dateFormat: "yy-mm-dd",
    changeMonth: true,
    changeYear: true,
    maxDate: "-16Y",
    minDate: "-100Y",
    yearRange: "-100:-16"
});

You can see the results in this fiddle.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文