A small tweak to the selected answer in jQuery UI DatePicker change highlighted "today" date
// Get users 'today' date
var localToday = new Date();
localToday.setDate(tomorrow.getDate()+1); // tomorrow
// Pass the today date to datepicker
$( "#datepicker" ).datepicker({
showButtonPanel: true,
localToday: localToday // This option determines the highlighted today date
});
I've overridden 2 datepicker methods to conditionally use a new setting for the "today" date instead of a new Date()
. The new setting is called localToday
.
Override $.datepicker._gotoToday
and $.datepicker._generateHTML
like this:
$.datepicker._gotoToday = function(id) {
/* ... */
var date = inst.settings.localToday || new Date()
/* ... */
}
$.datepicker._generateHTML = function(inst) {
/* ... */
tempDate = inst.settings.localToday || new Date()
/* ... */
}
Here's a demo which shows the full code and usage: http://jsfiddle.net/NAzz7/5/