// 获取当前日期
const currentDate = new Date();
// 获取年、月、日
const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(2, '0');
const day = String(currentDate.getDate()).padStart(2, '0');
// 格式化为 "yyyy-MM-dd" 格式
const formattedDate = `${year}-${month}-${day}`;
console.log(formattedDate); // 输出类似 "2023-08-31" 的格式化日期