I am looking for a datepicker for JQuery which allow my users to specify specific parts of the year. For example I want them to be able to pick summer months (April 01 - Sept 01). This data is going to be applicable every year so the actual year is irrelevant. Are there any datepickers out there that can do this for me. Or am I looking for the wrong thing?
views:
123answers:
4You could use the jQuery UI datepicker just set the year start and end to the same value, then use CSS to hide the yeah label (CSS class is ui-datepicker-year).
Similar to @Slace, I would suggest setting a maxDate/minDate for the dates in the range you want for the current year. You may want to define beforeShow and onClose handlers to add/remove the year from the selected string so that it doesn't appear in your input field.
Actually beforeShow method won't work since it is called before calendar is initialize.
So I added click event and also passed "dateFormat: 'dd/mm'" instead of onClose manipulation.
$(element_date).click( function( ) {
hideYear( );
});
$('.ui-datepicker-trigger').click( function( ) {
hideYear( );
});
function hideYear( ) {
$(".ui-datepicker-year").css( 'display', 'none' );
}
Hope this helps.....
An alternative to the jQuery UI datepicker:
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/
You can customize the acceptable start and end dates, as well as customize the CSS to not show the year.