-
Notifications
You must be signed in to change notification settings - Fork 8
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
tsOffset may fail depending on the Intl.DateTimeFormat implementation #23
Comments
@kossnocorp which browsers are supported? I see that |
@Perdolique Thanks for the tip on |
Yes, it seems to be a limitation in ![]() |
Have you managed to resolve this problem with older browsers with formatjs polyfills? |
I can confirm that formatjs polyfills does not fix the problem when formatting the date on iOS 15.4 or below. The error is Please also see #38 and formatjs/formatjs#4804 |
Until formatjs polyfills is fixed to correctly handle the above use case, I implemented a temporary fix for |
@ryaa Glad you found a workaround, sorry I meant to reply saying I didn't have any luck getting formatjs to do what I wanted either haha. I'll take a look into your patch! Do you have a snippet of the exact code you changed? Also, does your patch actually allow dates to still be formatted in the specified timezone? My fallback approach was just to use a normal date instead, and users on older browsers would have to deal with it haha. |
This patch will update two files
I believe yes. At least this is the requirement in my app and my patch seems to format the dates in any arbitrary timezone |
Nice, is there any reason not to PR this against the main project then? It seems like it would be generally helpful for people. |
The issue is with formatjs polyfills and the fix should be provided there, not in |
I guess that depends on how you look at it, if this package could offer a fallback without requiring a polyfill, that could be a better option for some people. |
…entation Changes: - provided a potential fix to support iOS 15.4 and below (see date-fns#23 (comment))
Here is the PR #45 |
tz/src/tzOffset/index.ts
Lines 18 to 23 in 2139037
The problem is that the format function is not bound to the class. So if the implementation for format() uses this, it will fail at runtime.
We can see the issue, when we use the Time Travel Chrom Extension which is very useful for testing
possible fix would be
The text was updated successfully, but these errors were encountered: