selection click elsewhere on the page or hit the ESC key from the key board to close. Then automatically selected date will be displayed in the input field.
Code for selecting only year from the datepicker:
After executing the above code, it will display an input field. If you click on the input field it will open date picker. Then by selecting any date it displays only year in the input field. Please go through the below screen shot for better understanding.
Select Year From Date