|
@@ -16,8 +16,20 @@ function getNowDate(type=0) {
|
|
|
}else if(type==1){
|
|
|
return `${year}年${month}月${day}日`;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+//修改格式为xxxx年xx月xx日
|
|
|
+
|
|
|
+function formatDate(date) {
|
|
|
+ if(!date) return '';
|
|
|
+ let d = new Date(date);
|
|
|
+ let year = d.getFullYear();
|
|
|
+ let month = d.getMonth() + 1;
|
|
|
+ let day = d.getDate();
|
|
|
+ if(month < 10) month = '0' + month;
|
|
|
+ if(day < 10) day = '0' + day;
|
|
|
+ return `${year}年${month}月${day}日`;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
//比较两时间之差
|
|
|
function DifferDate(Date1, Date2) {
|
|
@@ -36,13 +48,14 @@ function GetTime(data){
|
|
|
return `${sp1[0]}-${sp1[1]}-${sp1[2]} 至 ${sp2[2]}`
|
|
|
}else{
|
|
|
return `${sp1[0]}-${sp1[1]}-${sp1[2]} 至 ${sp2[1]}-${sp2[2]}`
|
|
|
- }
|
|
|
+ }
|
|
|
}else{
|
|
|
return cdata[0]+" 至 "+cdata[1]
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export {
|
|
|
+ formatDate,
|
|
|
getNowDate,
|
|
|
DifferDate,
|
|
|
GetTime,
|