views:

123

answers:

4

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?

+2  A: 

You 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).

Slace
I was really hoping for something to be out there. Maybe I should write my own rather than hacking something else but once again I don't really have time due to other pressures. So I guess I will be doing as you suggested.
uriDium
@uriDium - lol, its not hacking at all. He's just telling you to set two of the options for the plugin and then customize the CSS... two things that jQuery plugins pretty much expect you to do anyways. If you changed the color of the datepicker from red to blue, would you consider that 'hacking'?
Jakobud
A: 

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.

tvanfosson
A: 

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.....

Kurund Jalmi
A: 

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.

Jakobud