First off, thank you for this amazing library. I use it a ton and it's a godsend.
I'm running into perf limits when doing a lot of setZone() operations. These seem to be particularly slow on Chrome and I already reported it upstream https://bugs.chromium.org/p/chromium/issues/detail?id=928098
When I profile performance, the call stack setZone - > normalizeZone -> IANAZone -> isValidZone occurs a lot and takes up a lot of time. Can you expose the Zone API to the user so that we can look up zones once and use it with many timestamps? I think it would speed up these operations a lot, because the constructor of Intl.DateTimeFormat can be expensive (and on top of that, about 8x slower on Chrome currently than other browsers).
I noticed in the manual that we can already define Zone objects, but it's supposed to be used for custom stuff only? I think this could be extended to expose IANA zones with this interface.
I dug deeper and the IANAZone object is exported and has a constructor that seems to work fine. So no changes are required I guess, except for the manual/documentation? Is this supposed to be unstable, private API or can we use this and expect stability?
It's intentionally public but it is undocumented. It was originally private and I got basically this same request and we started exporting it, but we didn't update the docs. Would love those docs though!
Documented in b12d7fa
Most helpful comment
It's intentionally public but it is undocumented. It was originally private and I got basically this same request and we started exporting it, but we didn't update the docs. Would love those docs though!