I'm using jQuery UI plugin for datepicker and I need some features in it. I want users to be able to select date in following three formats:
- User can select only year.
- User can select year and month.
- User can select year, month and date from calendar.
Last one is obviously simple that user can select any date from calendar, I can also made datepicker to display year and month like below:
$(function() {
$('.date-picker').datepicker( {
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: 'MM yy',
onClose: function(dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(year, month, 1));
}
});
});
http://jsfiddle.net/bopperben/DBpJe/
But I can't find any way to achieve all above point together in same datepicker. If this is not possible in this plugin can you suggest me any other plugin which is user friendly. Thanks!