Created
May 31, 2025 07:24
-
-
Save ayoisaiah/b323b6dea6a7df6f962df619d64ee6f2 to your computer and use it in GitHub Desktop.
I
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.contextMenus.onClicked.addListener(async (info) => { | |
if (info.menuItemId === "createCalendarEvent") { | |
const selectedText = info.selectionText; | |
try { | |
const event = await parseEventDetails(selectedText); | |
const startTime = new Date(event.start_time); | |
const endTime = new Date(event.end_time); | |
event.dates = `${format(startTime)}/${format(endTime)};`; | |
const googleCalendarUrl = createGoogleCalendarUrl(event); | |
chrome.tabs.create({ url: googleCalendarUrl.toString() }); | |
} catch (e) { | |
console.log(e); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment