vue 時(shí)間顯示相關(guān)問題。
1.獲取當(dāng)前系統(tǒng)時(shí)間。
?const?nowDate?=?new?Date();
????????const?date2?=?{
??????????year:?nowDate.getFullYear(),
??????????month:?nowDate.getMonth()?+?1,
??????????date:?nowDate.getDate(),
????????};
????????const?newmonth?=?date2.month?>?10???date2.month?:?"0"?+?date2.month;
????????const?day2?=?date2.date?>?10???date2.date?:?"0"?+?date2.date;
====
console.log(date2.year?+?"-"?+?newmonth?+?"-"?+?day2)
2.計(jì)算日期相隔天數(shù)。
?let?sj?=?new?Date("2021-07-01");
?let?sj1?=?new?Date("2021-12-31");
?console.log(123,?parseInt(Math.abs(sj?-??sj1)??/??1000??/??60??/??60??/24));
3.集中處理表格中時(shí)間顯示不正確問題。? 2021-09-04T00:00:00.000+0000?=>?"2021-09-04"
解決:filter。

過濾方法

表單時(shí)間顯示