add
This commit is contained in:
@@ -36,4 +36,23 @@ export const dateFtt = date => {
|
||||
}
|
||||
return new Date(Date.parse(date))
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期
|
||||
*/
|
||||
export const getDate = type => {
|
||||
const date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
|
||||
if (type === 'start') {
|
||||
year = year - 10;
|
||||
} else if (type === 'end') {
|
||||
year = year + 10;
|
||||
}
|
||||
month = month > 9 ? month : '0' + month;
|
||||
day = day > 9 ? day : '0' + day;
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user