Skip to content

Commit df95e2d

Browse files
committed
feat: add end time
1 parent 7b0d45c commit df95e2d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/github.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ async function main() {
4242
const startTime = new Date(event.start.dateTime);
4343
const formattedStartTime = startTime.toLocaleString('zh-TW', { timeZone: 'Asia/Taipei', hour12: false });
4444

45+
let timeString = `**時間:** ${formattedStartTime}`;
46+
if (event.end && event.end.dateTime) {
47+
const endTime = new Date(event.end.dateTime);
48+
const formattedEndTime = endTime.toLocaleString('zh-TW', { timeZone: 'Asia/Taipei', hour12: false });
49+
timeString += ` - ${formattedEndTime}`;
50+
}
51+
4552
// Select quote randomly
4653
const randomIndex = Math.floor(Math.random() * QUOTES.length);
4754
const selectedQuote = QUOTES[randomIndex];
@@ -52,7 +59,7 @@ async function main() {
5259
color: getRandomColor(), // Use random color
5360
title: `🗓️ ${event.summary}`,
5461
title_link: event.htmlLink,
55-
text: `**時間:** ${formattedStartTime}
62+
text: `${timeString}
5663
5764
**地點/連結:** ${event.location || event.description || event.hangoutLink || '未指定'}
5865

0 commit comments

Comments
 (0)