Skip to content

Commit

Permalink
fix: fix the month number of release tag in case 1
Browse files Browse the repository at this point in the history
  • Loading branch information
RSS1102 committed Nov 13, 2024
1 parent e7f703c commit 7f22efd
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/auto-release/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,21 @@ export function getReleaseData() {
}
console.log(`今天是:${today},开始日期:${START_DATE},结束日期:${END_DATE}`);

// 标题
const monthShort = today.toLocaleString('en-US', { month: 'short' });
const year = today.getFullYear();
let times = '1st';
// release tag & 标题
let monthShort = today.toLocaleString('en-US', { month: 'short' });

const tagYear = today.getFullYear();
let tagMonth = today.getMonth() + 1;
let tagDay = today.getDate();

let times = '1st';

console.log('today', today.getDate());
switch (today.getDate()) {
case 1:
tagDay = 28;
tagMonth = today.getMonth();
monthShort = new Date(today.getFullYear(), today.getMonth() - 1).toLocaleString('en-US', { month: 'short' });
times = '4th';
break;
case 8:
Expand All @@ -86,12 +91,12 @@ export function getReleaseData() {
times = '3rd';
break;
default:
times = '1st';
console.error('日期不在指定范围内');
break;
}

const tag = `v${today.getFullYear()}.${today.getMonth() + 1}.${tagDay}`;
const title = `TDesign Weekly Release (${monthShort} ${times} ${year})`;
const tag = `v${tagYear}.${tagMonth}.${tagDay}`;
const title = `TDesign Weekly Release (${monthShort} ${times} ${tagYear})`;

console.log('tag', tag);
console.log('title', title);
Expand Down

0 comments on commit 7f22efd

Please sign in to comment.