我在这里使用 Trent Richardson 的 datetimepicker 。如何在日历上设置日期?以下正确设置了时间,但未设置突出显示为当前日期的日期。在这个特定的示例中,我正在劫持“现在”按钮单击以设置当前的 UTC 日期/时间。
$.datepicker._gotoToday = function (id) {
var inst = this._getInst($(id)[0]),
$dp = inst.dpDiv;
this._base_gotoToday(id);
var tp_inst = this._get(inst, 'timepicker');
var now = new Date();
var now_utc = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
//
// Time gets set correctly but the date highlight for current day is not getting set in the calendar picker.
this._setTime(inst, now_utc);
$('.ui-datepicker-today', $dp).click();