Bootstrap 3 DateTimePicker (eonasdan) - How to quickly select year? (for birthdays) -


is possible in eonasdan's bootstrap 3 datetimepicker change dayviewheaderformat show decades or drop-down menu choose year quickly?

because when wants insert birthday, might take lot of clicks select correct year , date. there option select correct year? if so, how work?

yes, possible using viewmode function. documentation:

viewmode(newviewmode)

takes string. valid values 'days', 'months', 'years' , 'decades'

for example:

$('#birthday_years').datetimepicker({     format: 'do of mmmm, yyyy',     defaultdate: new date(1990, 0, 1, 00, 01),     viewmode: 'years', }); 

here, i've initialised defaultdate 1990. can, of course, change or use placeholder display text in input field. so: <input ... ... placeholder="pick birthday" />. i've formatted date. can change date format with these options.

demonstration of final result:

enter image description here

> go demo


Comments