jquery-weui中的datetimePicker格式怎么只显示 年月 或者 年月日?
原创
©著作权归作者所有:来自51CTO博客作者成都阿信的原创作品,请联系作者获取转载授权,否则将追究法律责任
参考:https://segmentfault.com/q/1010000017023692
//核心代码
<script>
let allTime = '';
$("#time").datetimePicker({
times: function () {
return [
];
},
title: '出发时间',
min: "2014-12-12",
max: "2038-12-12",
onChange: function (picker, values, displayValues) {
console.log(values);
allTime = values;
let tempTime = values[0]+'-'+values[1]+'-'+values[2];
$("#time").html(tempTime);
}
});
/*$("#time").datetimePicker({
times: function () {
return [
{
values: ['上午', '下午']
}
];
},
value: '2012-12-12',
onChange: function (picker, values, displayValues) {
console.log(values);
allTime = values;
let tempTime = values[0]+'-'+values[1]+'-'+values[2];
$("#time").html(tempTime);
}
});*/
</script>
weui datePicker 默认日期/只显示年月
weui.datePicker({
start: 2006,
end: new Date().getFullYear(),
defaultValue: [new Date().getFullYear(), new Date().getMonth()+1, new Date().getDate()],
depth:2,
onChange: function (result) {
console.log(result);
},
onConfirm: function (result) {
console.log(result);
}
---------------------
作者:gdali
另外一篇:
https://yq.aliyun.com/articles/637576jquery-weui 时间选择器datetimepicker只要年月日不要时间解决方案