-
Notifications
You must be signed in to change notification settings - Fork 169
WIP: Cookbook example showing how to handle icalendar time zones #2894
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
base: main
Are you sure you want to change the base?
Conversation
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.
TODO: make sure it works
@justingrant If iCalendar is removing the custom time zone stuff from their specification after all, should we delete this example? Replace it with something else? Combining it with #1370 might be the best option, in that case. |
It's JSCalendar not iCalendar that's removing support for custom time zones, so that you can provide a time zone name only. In iCalendar AFAIK all time zones are custom-ish; you must supply time zone rules, not just a name.
Maybe have one sample that does both? AFAIK the rule semantics are similar even if the syntax is different. |
f47e152
to
99ced20
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2894 +/- ##
=======================================
Coverage 96.85% 96.85%
=======================================
Files 21 21
Lines 9983 9983
Branches 1829 1829
=======================================
Hits 9669 9669
Misses 268 268
Partials 46 46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.