Skip to content
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

Change timezone of simulator #4355

Open
puelocesar opened this issue Jan 31, 2024 · 4 comments
Open

Change timezone of simulator #4355

puelocesar opened this issue Jan 31, 2024 · 4 comments

Comments

@puelocesar
Copy link

Description

On Xcode, I can change the TimeZone of the simulator by going to "Edit Scheme -> Run configuration -> Arguments Tab -> Add Environment Variables" and add TZ as the iOS env. But I could not find a way of doing that on Detox, the only thing I found on the documentation was launch args, which is a different thing.

Is there a way to achieve this with Detox? I tried several ways of passing TZ, but none worked

Your environment

Detox version:
React Native version:
Node version:
Device model:
OS:
Test-runner (select one): jest / other

@noomorph
Copy link
Collaborator

noomorph commented Feb 6, 2024

@asafkorem any idea?

@asafkorem
Copy link
Contributor

asafkorem commented Feb 8, 2024

Hey @puelocesar,
If you refer to the user's current local (NSLocale.currentLocale) we don't currently have such a feature, but I believe it won't be very complicated to implement, if we'll swizzle the current locale within Detox.
Not sure how it can be implemented on Android (@gosha212 / @d4vidi ?)

Anyhow, it's very likely that we won't do that, since that's something that can be mocked within your app easily. Just make a date/time provider (which can be a soft wrapper for your current provider) in your code and mock it. You can use launch-arg as a parameter for the mocking.

Copy link

stale bot commented Mar 17, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this repository, read this discussion.

@stale stale bot added the 🏚 stale label Mar 17, 2024
@luke92
Copy link

luke92 commented Sep 7, 2024

In Bitrise and my local machine works fine compare Dates with iOS
So for iOS i don't need change the timezone.

But using Android in my Local machine is in UTC
Should i use something like this?
adb shell setprop persist.sys.timezone "America/New_York"

Thanks

@stale stale bot removed the 🏚 stale label Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants