You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you click into a datetimepicker field that is blank, it brings up the calendar panel and displays the current date, but the time is set to "12:00 pm".
I have rather complex initialization code, as I have implemented it as a Tapestry component for selecting both dates and date/times.
var $field = $("#" + spec.id);
var $container = $field.parent(".input-append");
var $hidden = $container.find("input[type=hidden]");
var initialUTC = $hidden.val();
var initialDate = initialUTC === "" ? null : new Date(parseInt(initialUTC));
var picker = $field[spec.time ? "datetimepicker" : "datepicker"];
var options = {
dateFormat: "mm/dd/yy",
changeMonth: spec.distant,
changeYear: spec.distant,
onClose: function (dateStr) {
var date = picker.call($field, "getDate");
$hidden.val(date == null ? "" : date.getTime());
}
};
if (spec.min) {
options.minDate = new Date(spec.min);
}
if (spec.max) {
options.maxDate = new Date(spec.max);
}
if (spec.time) {
_.extend(options, {
dateTimeFormat: "mm/dd/yy hh:mm tt",
ampm: true,
showButtonPanel: true,
defaultDate : new Date()
});
}
picker.call($field, options);
if (initialDate) {
picker.call($field, "setDate", initialDate);
}
// If Tapestry autofocuses on a field, the widget isn't displayed. This
// checks at page load if the field is focused, and shows the correct
// picker.
$(function () {
if (document.activeElement == $field[0]) {
$field[spec.time ? "datetimepicker" : "datepicker"]("show");
}
});
$container.find(".add-on").click(function () {
$field.focus();
})
}
However, I think you can pick out how options is constructed and passed to $.fn.datetimepicker(). I would expect that clicking on the field would use the defaultDate, including the time portion.
The text was updated successfully, but these errors were encountered:
When you click into a datetimepicker field that is blank, it brings up the calendar panel and displays the current date, but the time is set to "12:00 pm".
I have rather complex initialization code, as I have implemented it as a Tapestry component for selecting both dates and date/times.
However, I think you can pick out how
options
is constructed and passed to$.fn.datetimepicker()
. I would expect that clicking on the field would use the defaultDate, including the time portion.The text was updated successfully, but these errors were encountered: