ui
This commit is contained in:
@@ -86,4 +86,35 @@ function saveData(data, filename) {
|
||||
aLink.click()
|
||||
//没有清理的 DOM 元素引用
|
||||
//document.body.removeChild(aLink)
|
||||
}
|
||||
|
||||
function getCurrentYearStart() {
|
||||
const currentDate = new Date();
|
||||
return new Date(currentDate.getFullYear(), 0, 1, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
function formatDate(date, format) {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
|
||||
return format
|
||||
.replace('YYYY', year)
|
||||
.replace('MM', month)
|
||||
.replace('DD', day)
|
||||
.replace('HH', hours)
|
||||
.replace('mm', minutes)
|
||||
.replace('ss', seconds);
|
||||
}
|
||||
|
||||
function getCurrentMonthEnd() {
|
||||
const currentDate = new Date();
|
||||
const currentYear = currentDate.getFullYear();
|
||||
const currentMonth = currentDate.getMonth();
|
||||
const lastDayOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
||||
const lastDate = lastDayOfMonth.getDate();
|
||||
return new Date(currentYear, currentMonth, lastDate, 23, 59, 59, 999);
|
||||
}
|
||||
Reference in New Issue
Block a user