-
Notifications
You must be signed in to change notification settings - Fork 153
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
WIP: Cookbook example showing how to handle icalendar time zones #2894
base: main
Are you sure you want to change the base?
Conversation
TODO: Add test data & make sure it works TODO: Comment code better & add page in cookbook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this, seems like a reasonable starting point.
} | ||
// this.#impl with a non-IANA time zone uses UTC internally, so we can just | ||
// calculate the plain date-time in UTC and add the UTC offset. | ||
return this.#impl.toPlainDateTime().add({ nanoseconds: this.offsetNanoseconds }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this break around DST transitions that PDT is unaware of? That may be OK for a cookbook sample, but it may deserve a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it'll break. this.#impl.toPlainDateTime()
will be unaware of any DST transitions at all, but adding this.offsetNanoseconds
will correctly account for DST transitions in the VTIMEZONE.
This is an example of how a ZonedDateTime object with a custom time zone could work, if TimeZone objects are removed. (#2853)
This shows integration with ical.js. It's a ZonedDateTime-wrapper object that internally maintains a real
Temporal.ZonedDateTime
object, but it takes anICAL.Timezone
instead of aTemporal.TimeZone
. If theICAL.Timezone
object has the ID of an IANA time zone, we delegate everything to the realTemporal.ZonedDateTime
and use the host's time zone database. If the ID is not an IANA ID, we fall back to theICAL.Timezone
'sVTIMEZONE
data.Draft; still needs test data with which to make sure everything works, and a cookbook page.