|
|
|
export function getNowFormatDate() {
|
|
|
|
var date = new Date();
|
|
|
|
var seperator1 = "-";
|
|
|
|
var year = date.getFullYear();
|
|
|
|
var month = date.getMonth() + 1;
|
|
|
|
var strDate = date.getDate();
|
|
|
|
if (month >= 1 && month <= 9) {
|
|
|
|
month = "0" + month;
|
|
|
|
}
|
|
|
|
if (strDate >= 0 && strDate <= 9) {
|
|
|
|
strDate = "0" + strDate;
|
|
|
|
}
|
|
|
|
var currentdate = year + seperator1 + month + seperator1 + strDate;
|
|
|
|
return currentdate;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getNextWeekFormatDate() {
|
|
|
|
var now = new Date();
|
|
|
|
var date = new Date(now.getTime() + 7 * 24 * 3600 * 1000);
|
|
|
|
var seperator1 = "-";
|
|
|
|
var year = date.getFullYear();
|
|
|
|
var month = date.getMonth() + 1;
|
|
|
|
var strDate = date.getDate();
|
|
|
|
if (month >= 1 && month <= 9) {
|
|
|
|
month = "0" + month;
|
|
|
|
}
|
|
|
|
if (strDate >= 0 && strDate <= 9) {
|
|
|
|
strDate = "0" + strDate;
|
|
|
|
}
|
|
|
|
var currentdate = year + seperator1 + month + seperator1 + strDate;
|
|
|
|
return currentdate;
|
|
|
|
}
|
|
|
|
export function getNowFormatTime() {
|
|
|
|
var now = new Date();
|
|
|
|
var hour = now.getHours();//得到小时
|
|
|
|
var minu = now.getMinutes();//得到分钟
|
|
|
|
var sec = now.getSeconds();//得到秒
|
|
|
|
if (hour < 10) hour = "0" + hour;
|
|
|
|
if (minu < 10) minu = "0" + minu;
|
|
|
|
if (sec < 10) sec = "0" + sec;
|
|
|
|
var time = "";
|
|
|
|
time = hour + ":" + minu + ":" + sec;
|
|
|
|
return time;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function getResConstruction(res = "") {
|
|
|
|
switch ((res || "").constructor) {
|
|
|
|
case Array:
|
|
|
|
return "[" + getResConstruction(res[0] || "") + "]";
|
|
|
|
case Object:
|
|
|
|
return "{" + Object.keys(res).map(key => {
|
|
|
|
let value = getResConstruction(res[key]);
|
|
|
|
return key + (value ? ":" + value : "")
|
|
|
|
}).join(",") + "}"
|
|
|
|
default:
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|