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

Sample code for adding tzid to start/end times of an event #499

Open
rdorris opened this issue Feb 22, 2022 · 2 comments
Open

Sample code for adding tzid to start/end times of an event #499

rdorris opened this issue Feb 22, 2022 · 2 comments

Comments

@rdorris
Copy link

rdorris commented Feb 22, 2022

Using ical.js to build an ics for export and I need all the events to have the timezone of "America/Los_Angeles". Wonder if you could provide a few lines of code that would set the timezone and when exported, have the DTSTART/DTEND both have tzid on them?

I've tried

const PT = new ICAL.Property("tzid");
PT.setParameter("tzid", "America/Los_Angeles");
event.startDate = ICAL.Time.fromDateTimeString(kendo.toString(schedulerEvent.start, "yyyy-MM-ddTHH:mm:ss"), PT);

and I've tried

let tzid = new ICAL.Timezone({ component: vevent, tzid: "America/Los_Angeles" });
event.startDate.zone = tzid;

but neither add the tzid to the output component.toString()
Thanks you very much for the help!

@ohsailey
Copy link

@rdorris hello, have you solved this problem?

@rdorris
Copy link
Author

rdorris commented Feb 17, 2023

@ohsailey Looking at code from a year ago; looks like I created all the events in UTC and then they get converted based on user's timezone during import.

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

No branches or pull requests

3 participants