Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support datetime format for triggers of valarm #475

Open
AustinZhang1024 opened this issue Jan 14, 2025 · 0 comments
Open

Support datetime format for triggers of valarm #475

AustinZhang1024 opened this issue Jan 14, 2025 · 0 comments

Comments

@AustinZhang1024
Copy link

AustinZhang1024 commented Jan 14, 2025

The problem

Support trigger like this:

BEGIN:VALARM
TRIGGER:20250114T133635Z
ACTION:DISPLAY
DESCRIPTION:On time reminder
END:VALARM

It reports Error: invalid duration value: Not enough duration components in "133635Z"

Related issue: #120
Related code:

var trigger = valarm.getFirstPropertyValue('trigger').toString();

GAS-ICS-Sync/ical.js.gs

Lines 715 to 730 in e0f8c14

value: function fromString(aStr) {
var pos = 0;
var dict = Object.create(null);
var chunks = 0;
while ((pos = aStr.search(DURATION_LETTERS)) !== -1) {
var type = aStr[pos];
var numeric = aStr.slice(0, Math.max(0, pos));
aStr = aStr.slice(pos + 1);
chunks += parseDurationChunk(type, numeric, dict);
}
if (chunks < 2) {
// There must be at least a chunk with "P" and some unit chunk
throw new Error('invalid duration value: Not enough duration components in "' + aStr + '"');
}
return new Duration(dict);
}

Version of GAS-ICS-Sync

5.8

Additional information & file uploads

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant