公告板
版本库
filestore
活动
搜索
登录
张先祾
/
nongtou-uni
概况
操作记录
提交次数
目录
文档
派生
对比
blame
|
历史
|
原始文档
遮挡问题
zxl
15 小时以前
2cb1add64f6a28da8616d5eb6f5bdb4ad1d7a7e6
[~zxl/nongtou-uni.git]
/
utils
/
util.js
1
2
3
4
5
6
7
8
9
10
/**
* 获得当前时间的月份,格式为YYYY-MM
* @returns {string} 当前时间的月份,格式为YYYY-MM
*/
export function getCurrentMonth() {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要+1
return `${year}-${month}`;
}