Skip to content

Reset Hermes timezone cache on system timezone change#55467

Open
Im-awesome-Aadi wants to merge 1 commit intofacebook:mainfrom
Im-awesome-Aadi:fix/my-awesome-fix
Open

Reset Hermes timezone cache on system timezone change#55467
Im-awesome-Aadi wants to merge 1 commit intofacebook:mainfrom
Im-awesome-Aadi:fix/my-awesome-fix

Conversation

@Im-awesome-Aadi
Copy link

@Im-awesome-Aadi Im-awesome-Aadi commented Feb 8, 2026

Changelog: [Android] [Fixed] Reset Hermes timezone cache on system timezone change
Summary:

When the device timezone changes while the app is running, JavaScript Date still return the local time according to the previous timezone.

This happens because Hermes caches timezone information to improve performance. If the device timezone changes during app runtime, local time calculations continue using the old cached timezone.

Hermes provides a native API, resetTimezoneCache(), to reset this cached information. This PR adds an internal Android module that calls this API whenever the platform detects a timezone change.

Changes:

Kotlin: TimeZoneModule

Listens for Intent.ACTION_TIMEZONE_CHANGED broadcasts

Calls a JNI method to reset Hermes timezone cache

Safely registers/unregisters the receiver during Catalyst lifecycle

Open for unit testing

C++: TimeZoneCache

Provides resetNativeHermesTimeZoneCache() JNI method

Calls hermes::IHermes::resetTimezoneCache()

No-op if runtime pointer is null or runtime is not Hermes

Test Plan:

Java unit tests

Verify broadcast receiver registration/unregistration

Verify native reset hook is invoked on timezone change

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 8, 2026
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Feb 8, 2026
…mezone change

Summary:

When the device timezone changes while the app is running, JavaScript Date still return the local time according to the previous timezone.

This happens because Hermes caches timezone information to improve performance. If the device timezone changes during app runtime, local time calculations continue using the old cached timezone.

Hermes provides a native API, resetTimezoneCache(), to reset this cached information. This PR adds an internal Android module that calls this API whenever the platform detects a timezone change.

Changes:

Kotlin: TimeZoneModule

Listens for Intent.ACTION_TIMEZONE_CHANGED broadcasts

Calls a JNI method to reset Hermes timezone cache

Safely registers/unregisters the receiver during Catalyst lifecycle

Open for unit testing

C++: TimeZoneCache

Provides resetNativeHermesTimeZoneCache() JNI method

Calls hermes::IHermes::resetTimezoneCache()

No-op if runtime pointer is null or runtime is not Hermes

Test Plan:

Java unit tests

Verify broadcast receiver registration/unregistration

Verify native reset hook is invoked on timezone change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants