参考:​​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/637576​​​​jquery-weui 时间选择器datetimepicker只要年月日不要时间解决方案​