Created
March 10, 2021 22:29
-
-
Save bsoist/9f4d90c7facea69a8ef3bdc25fb34eb7 to your computer and use it in GitHub Desktop.
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
// edit the next line to use your calendars | |
calendars = ['home', 'work', 'evilplan']; | |
inputString = editor.getText(); | |
stringParts = inputString.split('\n'); | |
dateTimeDetails = stringParts[1]; | |
cal = stringParts[2]; | |
calendar = stringParts[2].slice(0,cal.length).toLowerCase(); | |
newText = ''; | |
calendars.forEach(function(c){ | |
if (calendar === c) { | |
event = stringParts[0]; | |
} else { | |
event = "busy"; | |
} | |
newText += event + ' ' + dateTimeDetails; | |
newText += ' /' + c; | |
newText += '\n'; | |
}); | |
editor.setText(newText); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment