[英]momentjs concat date and time not working
我正在嘗試使用 momentjs 將日期字符串和時間字符串組合成一個日期時間時刻。
輸入:
console.log(values.startDate);
console.log(values.startTime);
console.log(moment(values.startDate + values.startTime, 'LLL').format('LLL'));
預期 output:
August 10, 2020
5:19 PM
August 10, 2020 5:19 PM
當前 output:
August 10, 2020
5:19 PM // startTime prints correctly here
August 10, 2020 12:00 AM // but not here
startTime
出了什么問題?
日期和時間之間缺少空格
console.log(moment(values.startDate + values.startTime, 'LLL').format('LLL'))
至
console.log(moment(values.startDate +" "+ values.startTime, 'LLL').format('LLL'))
希望它能解決你的問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.