
But, the good news is, you can (rather easy) use the jQuery framework to tweak the result that's returned from the datepicker.
Just create a Dynamic Action that fires on load of the page, and add these line of Javascript:
//Show the week number as the first column
$( ".datepicker" ).datepicker( "option", "showWeek", true );
//Set Monday as the first day of the week
$( ".datepicker" ).datepicker( "option", "firstDay", 1 );
//Return yyyy-ww instead of the actual date
$(".datepicker").datepicker("option", "onSelect",
function(value, date)
{ var week=$.datepicker.iso8601Week (
new Date(date.selectedYear,
date.selectedMonth,
date.selectedDay));
$(this).val(date.selectedYear+'-'+(week<10?'0':'')+week);
}
);
That's it. Of course you have to replace the jQuery selector - $(".datepicker") - with the one that matches your selection.
You can also substitute the function that generates the week number with your own one. And, yes, you could turn this into a plug-in if you like... (maybe I will when I've got the time, but no guarantee).
Comments