简体   繁体   English

引导日期选择器:从年份开始选择日期

[英]Bootstrap datepicker: Start picking date from year

Normally when selecting dates from immediate vicinity of 'today', default behaviour (picking a day of month) works well but when picking birthdays I want the user to start picking the date from years. 通常,从“今天”附近选择日期时,默认行为(选择一个月中的某天)效果很好,但是当选择生日时,我希望用户开始从年份中选择日期。 I looked at the docs but couldn't find any option to do this. 我查看了文档,但找不到任何选择来执行此操作。 I want the datepicker to open with years selection first. 我希望日期选择器首先打开年份选择。 As shown in this picture: 如下图所示:

在此处输入图片说明

I'm using this plugin: https://bootstrapdatepicker.readthedocs.io/en/latest/ 我正在使用此插件: https : //bootstrapdatepicker.readthedocs.io/en/latest/

Use startView option (0-days, 1-months, 2-years, see plugin docs): 使用startView选项(0天,1个月,2年,请参阅插件文档):

$('#date').datepicker({
    startView:2//
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM