获取当前年份
let timestamp = Date.parse(new Date());
let date = new Date(timestamp);
//获取年份
let thisYear = date.getFullYear();
获取当前月份
let timestamp = Date.parse(new Date());
let date = new Date(timestamp);
// 获取月份
let thisMonth = date.getMonth() + 1; // 返回值为1-12之间的整数
// 将月份值转换为带有前导零的文本形式
let formattedMonth = thisMonth.toString().padStart(2, '0');