Skip to content

Commit 0d33027

Browse files
Merge pull request #6 from littleCareless/feature/fix-weekly-report-formatting
🌐 chore(locale): 优化周报生成完成的提示语
2 parents 0acce20 + efebbe3 commit 0d33027

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

i18n/en.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"ai.model.loading": "Loading AI model list...",
7070
"weeklyReport.generating": "Generating weekly report...",
7171
"weeklyReport.empty.response": "AI generated content is empty",
72-
"weeklyReport.generation.success": "Weekly report generated successfully: : {0} {1}",
72+
"weeklyReport.generation.success": "Weekly report for {1} ({0}) has been generated successfully",
7373
"weeklyReport.generation.failed": "Failed to generate weekly report: {0}",
7474
"weeklyReport.copy.success": "Content copied to clipboard",
7575
"weeklyReport.copy.failed": "Copy failed: {0}",

i18n/zh-cn.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"ai.model.loading": "正在加载 AI 模型列表...",
6868
"weeklyReport.generating": "正在生成周报...",
6969
"weeklyReport.empty.response": "AI 生成内容为空",
70-
"weeklyReport.generation.success": "周报生成成功: {0} {1}",
70+
"weeklyReport.generation.success": "{1}的{0}工作周报已生成完成",
7171
"weeklyReport.generation.failed": "生成周报失败: {0}",
7272
"weeklyReport.copy.success": "内容已复制到剪贴板",
7373
"weeklyReport.copy.failed": "复制失败: {0}",

src/commands.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { GenerateCommitCommand } from "./commands/GenerateCommitCommand";
44
import { SelectModelCommand } from "./commands/SelectModelCommand";
55
import { GenerateWeeklyReportCommand } from "./commands/GenerateWeeklyReportCommand";
66
import { ReviewCodeCommand } from "./commands/ReviewCodeCommand";
7-
import { notify } from "./utils/notification/NotificationManager";
7+
import { notify } from "./utils";
88

99
/**
1010
* 管理VS Code命令的注册和销毁

src/webview/handlers/WeeklyReportMessageHandler.ts

+6-9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class WeeklyReportMessageHandler {
3535
command: "report",
3636
data: report,
3737
});
38-
38+
console.log("message.data.period", message.data.period);
3939
const formattedPeriod = this.formatPeriod(message.data.period);
4040
console.log("formattedPeriod", formattedPeriod);
4141
notify.info("weeklyReport.generation.success", [formattedPeriod, author]);
@@ -46,20 +46,17 @@ export class WeeklyReportMessageHandler {
4646
}
4747
}
4848

49-
private formatPeriod(period: string): string {
50-
const now = new Date();
51-
const weeks = parseInt(period);
52-
const pastDate = new Date(now.setDate(now.getDate() - weeks * 7));
53-
54-
const formatDate = (date: Date) => {
49+
private formatPeriod(period: { startDate: string; endDate: string }): string {
50+
const formatDate = (dateStr: string) => {
51+
const date = new Date(dateStr);
5552
const yyyy = date.getFullYear();
5653
const mm = String(date.getMonth() + 1).padStart(2, "0");
5754
const dd = String(date.getDate()).padStart(2, "0");
5855
return `${yyyy} ${mm} ${dd}`;
5956
};
6057

61-
const endDate = formatDate(new Date());
62-
const startDate = formatDate(pastDate);
58+
const startDate = formatDate(period.startDate);
59+
const endDate = formatDate(period.endDate);
6360
return `${startDate} - ${endDate}`;
6461
}
6562
}

0 commit comments

Comments
 (0)