Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS/AngularUI: Datepicker to only show years?

I am using AngularUI with AngularJS, and I was wondering if there was a way to just see the year calendar with the Datepicker, not giving them the option to choose month and day. I tried looking at the documentation and on the js file itself but it doesn't seem like it's possible. Does anyone have any experience with this?

This is the documentation that I looked at (for the Datepicker): http://angular-ui.github.io/bootstrap/

like image 449
changus Avatar asked Nov 26 '13 19:11

changus


1 Answers

You can set the min-mode to 'year' and format the date to be yyyy

$scope.dateOptions = {
    formatYear: 'yyyy',
    startingDay: 1,
    minMode: 'year'
};

DEMO: http://plnkr.co/edit/0SPMYQ6ND7AOfZwDAFB8?p=preview

like image 91
Lauwrentius Avatar answered Nov 27 '22 02:11

Lauwrentius