views:

876

answers:

3

Hi,

I am looking for a Javascript-based date picker that would allow me to display one week only (instead of the current month).

Ideally it should be one that can be expanded to a full month view if necessary and back again.

Also, (css based?) design customizability would be a plus.

A jQuery solution would be preferred. I've had a brief look at the jQuery datepicker, but it seemed to me that it can only display full months. Please let me know if I am wrong.

Thanks,

Adrian

A: 

A date picker widget is overkill if you only have seven options. Just use a dropdown. A neat JavaScript trick is that you can add 1 day to any date and it will handle month/year rollovers automatically. The following code will always give you the next 7 days (starting with today):

var dates = [new Date()];
for (var i = 1; i < 7; i++) dates.push(new Date(dates[0].getYear(), dates[0].getMonth(), dates[0].getDate() + i));
jiggy
A: 

I'm not sure, but maybe you can customize this http://jqueryui.com/demos/datepicker/

Ones that show just one week I know none :(

Edit: After inspect, it shows to be CSS based, I've run through it's options but couldn't find anything just to show one week. Rather there is one which allows you to select only one week though, dunno what the supposed effect is though.

fmsf
+3  A: 

The jQuery UI datepicker, as has been noted, can not easily be configured to display only one week. You can however use the maxDate and minDate configuration options to constrain the user's input. Here is an example of this functionality.

To answer your specific question, I am not aware of any datepicker control which will only display one week.

Ken Browning
Sadly, it seems that you were right. On the bright side it was relatively easy to code my own though.
Adrian Grigore