Skip to content

How does Luxon abuse the Intl API? #1370

Answered by icambron
slominskir asked this question in Q&A
Discussion options

You must be logged in to vote

It's not fragile at all, but it has a few limitations, such as handling historical zones that have fractional-minute offsets, and likely hypothetical time zones where the offset shifts multiple times in quick succession. It's also unlikely to be a relevant use case for performance optimizations that browsers make to the Intl API. The abuse is that the Intl API will return a structured output (see formatToParts) which can be used to calculate the current offset with a bit of logic. Here is a detailed answer I gave explaining that logic, as part of answer to how someone could, hypothetically, detect ambiguous local times: #1018 (comment).

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@slominskir
Comment options

@icambron
Comment options

@slominskir
Comment options

Answer selected by slominskir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants