我有一个easyui-datebox
访问它,提示日期形式jan 1970
我怎么能让他们最初显示当前日期(即)有什么像setInitialDate()
也如何我设置日期范围像setStartDate()
和setEndDate()
这是一个问题:JQuery easyui and Datejs date conflict。当您使用带easyui的Date.js时,会出现此问题。如果从Web资源中删除Date.js,则打开日期框会在第一次弹出时自动显示当前日期。解决方法是在启动日期字段后使用以下代码。
$('#dateDuetxt').datebox({
value: (new Date().toString('dd-MMM-yyyy')) /* Date.js toString function to convert date into format that is being used by datebox. */
});
完整的示例代码是:
Due Date <input id="dateDuetxt" class="easyui-datebox" style="width:100px"/>
<script>
$('#dateDuetxt').datebox({
value: (new Date().toString('dd-MMM-yyyy')), /* Date.js toString function to convert date into format that is being used by datebox. */
formatter : function(date){
return date.toString('dd-MMM-yyyy');
},
parser : function(s){
var t = Date.parse(s);
if (!isNaN(t)){
return new Date(t);
} else {
return null;
}
}
});
</script>
但是,如果从页面中删除Date.js,则不需要编写脚本,只需创建日期框即可
Due Date <input id="dateDuetxt" class="easyui-datebox" style="width:100px"/>
会做的伎俩。