-
-
Notifications
You must be signed in to change notification settings - Fork 34
Timezone changes are not correctly applied to NS runtime #216
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
Comments
A note regarding this. In android runtime, we have this feature configurable using In iOS runtime, we'll need a listener that calls V8's |
@CatchABus , thanks for the directions. The Android solution (handleTimeZoneChanges) I have already found. Do you know of an example app where I could see how this needs to be done on IOS? |
I created a draft that exposes the V8 function to the user, so you can manually reset the timezone (by attaching a notification observer and calling that function). It's still a draft because I believe we can implement |
@edusperoni : thanks for the directions. I assume you mean I need to call it from an application event
What would I have to provide for the parameters? Thanks for the directions. I think there should also be a refresh of all opened ui pages. I have seen on android, that I manually have to reload all data on all opened pages in order for the timezone change to take effect in the ui |
@cjohn001 tbh I didn't even know that flag existed on Android 😅. The PR I did exposes the function on iOS so the user can register the notification listener and call that in userland. We're still debating if this change is better handled as in core (core will register the notification and call it) or in the runtime as Android does it. Tbh I expect the TimeZone to be accurate even without any flags. |
@edusperoni : I am absolutely with you, handleTimeZoneChanges on android should be true by default and it would be great if the user would not have to handle things manually with a notification listener on ios as well. I will than wait for the result of your discussions :) |
@edusperoni I digged like a lot to find a 2018 PR implementing this and I was shocked about its existence as well :D @cjohn001 If we call that runtime method for both platforms, android will have to use a BroadcastReceiver to track change by checking for Regarding iOS, I think an |
@CatchABus my only issue is that it needs to be called per isolate, and the callbacks are called in the main thread. This means that it'll try to enter the worker isolates from the main thread which could lead to locking the main thread if the worker is doing heavy work. If done at the runtime level, we can dispatch a message to the worker's runloop. If done at core level, I'd most likely create a native helper that would wrap the callback to replicate the same behavior. |
Uh oh!
There was an error while loading. Please reload this page.
Issue Description
When changing the timezone settings on iOS the locale seems to be changed, but the time is not set to the correct time for that timezone.
Here is an example on IOS from Date object:
Starting in London timezone:
time: Mon Jun 05 2023 15:50:00 GMT+0100 (BST)
switching timezone to CEST (GMT+0200):
time: Mon Jun 05 2023 15:50:15 GMT+0100 (CEST)
--> you can see, time zone was switched but time is not updated to reflect time in timezone (should be +0200)
After restarting application the timezone is set up correctly.
time: Mon Jun 05 2023 16:53:10 GMT+0200 (CEST)
Please note, I had an initial issue in the NS core repo
NativeScript/NativeScript#10300
However, seems like the correct place is here. When setting:
like recommended here:
NativeScript/NativeScript#10300 (comment)
things are working correctly on Android.
I tried also setting this flag for"ios", however, this had no effect.
Reproduction
console.log( new Date());
switch timezone via device settings
Workaround
The only workaround I have found so far is forcing the app to close. On restart the timezone settings or ok.
Environment
Dependencies
The text was updated successfully, but these errors were encountered: