Skip to content

Commit 2107a0c

Browse files
committed
fix: sync script
1 parent 6748641 commit 2107a0c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

script/front-matter.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ async function updateFrontMatter(login, item) {
6868

6969
// 主函数
7070
async function main() {
71-
const year = new Date().getFullYear();
71+
const date = new Date();
72+
date.setMonth(date.getMonth() - 1);
73+
const year = date.getFullYear();
7274
try {
7375
const rankingsData = await readRankingData(year);
7476

script/update_year_user.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ async function enrichRankingData(data) {
9797

9898
// 主函数
9999
async function main() {
100-
const year = new Date().getFullYear();
100+
const date = new Date();
101+
date.setMonth(date.getMonth() - 1);
102+
const year = date.getFullYear();
101103
try {
102104
const rankingsData = await readRankingData();
103105
const yearData = rankingsData.find(yearData => yearData.year === year);

0 commit comments

Comments
 (0)