调API接口查询数据时,请求参数的时间格式错误导致后台接口报400错误

错误的日期格式
{
"condition": { "startTime": "2019-11-6 00:00:00", "endTime": "2019-11-7 00:00:00" }, "pageSize": 100, "pageNum": 1 } 正确的日期格式 如果日期是1-9号,则前面需要加上0 { "condition": { "startTime": "2019-11-06 00:00:00", "endTime": "2019-11-07 00:00:00" }, "pageSize": 100, "pageNum": 1 }


// 转换日期的方法
function dateFormat(date) {
return `${date.getFullYear()}-${date.getMonth() + 1}-${(date.getDate() > 9) ? date.getDate() : '0' + date.getDate()} 00:00:00`
}
 

 

posted @ 2019-11-25 14:22  jamess  阅读(1963)  评论(0编辑  收藏  举报