我正在使用一个日期时间选择器 http://eonasdan.github.io/bootstrap-datetimepicker/来自 Eonasdan ,到目前为止效果很好。
我有一个像这样的 HTML 元素
<div id="datetimepicker"></div>
并使用 datetimepicker 函数,如下所示:
$("#datetimepicker").datetimepicker({
inline: true,
sideBySide: true,
stepping: 5,
locale: "de"
});
The result looks like this:
我想通过 Javascript 使用以下命令更新日期date http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#date功能。我的尝试看起来像这样:
$("#datetimepicker").data("DateTimePicker").date("2016-01-01");
不幸的是,这仅返回一个大对象,并且不会以任何方式改变可见日期。该对象被返回
Object { destroy: c/l.destroy(), toggle: c/ha(), show: c/ga(), hide: c/ba(),
disable: c/l.disable(), enable: c/l.enable(), ignoreReadonly: c/l.ignoreReadonly(),
options: c/l.options(), date: c/l.date(), format: c/l.format(), 40 weitere… }
使用不同的时间格式或仅采用日期而不采用时间或任何其他方式也无济于事。
我在各个网站上找到的建议解决方案都没有解决我的问题。不知道是否需要更新元素?如果是这样,我该怎么做?我在文档中找不到任何提示...
不能选择使用 defaultDate,因为我需要使用两个不同的日期执行此过程两次。