npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@callstack/timezone-hermes-fix

v0.4.0

Published

Fix for resetting the timezone cache, while the timezone is changed

Readme

🕐 Timezone Hermes Fix

Timezone Hermes Fix is a cross-platform React Native library that provides a robust workaround for timezone-related issues when using the Hermes JavaScript engine. It includes native modules for both Android and iOS, designed as a drop-in solution for React Native projects requiring accurate timezone handling.

🚀 Support

[!WARNING]
This library is supported from React Native 0.80.2 and above.

🔧 The Problem

React Native apps using the Hermes JavaScript engine may experience timezone calculation issues, particularly when:

  • The device timezone changes while the app is running
  • Date/time calculations don't reflect the current timezone
  • Inconsistent behavior across different devices or regions

This library fixes these known issues by providing native timezone cache reset.

📦 Installation

Using Yarn (recommended)

yarn add @callstack/timezone-hermes-fix

Using npm

npm install @callstack/timezone-hermes-fix

🎯 Usage

Quick Start with Hook

The easiest way to use the library is with the provided React hook:

import React from 'react';
import { View, Text } from 'react-native';
import { useTimezoneHermesFix } from '@callstack/timezone-hermes-fix';

export default function App() {
  const { currentTimezone } = useTimezoneHermesFix();

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text>Current Timezone: {currentTimezone}</Text>
      <Text>Current Time: {new Date().toLocaleString()}</Text>
    </View>
  );
}

Direct Native Module Usage

For more control, you can use the native module directly:

import { NativeTimezoneHermesFix } from '@callstack/timezone-hermes-fix';

// Get current timezone information
const timezone = NativeTimezoneHermesFix.getCurrentTimeZone();
console.log('Timezone:', timezone.name); // "America/New_York"
console.log('GMT Offset:', timezone.secondsFromGMT); // -18000 (for EST)
console.log('DST Active:', timezone.isDaylightSavingTime); // true/false

// Get all supported timezones
const supportedTimezones = NativeTimezoneHermesFix.getSupportedTimeZones();
console.log('Available timezones:', supportedTimezones.length);

// Listen for timezone changes
const subscription = NativeTimezoneHermesFix.onTimezoneChange.addListener(
  (newTimezone) => {
    console.log('Timezone changed to:', newTimezone.name);
    console.log('New GMT offset:', newTimezone.secondsFromGMT);
    console.log('DST status:', newTimezone.isDaylightSavingTime);
  }
);

// Clean up listener when component unmounts
// subscription.remove();

📱 API Reference

Types

type CurrentTimezone = {
  name: string; // e.g., "America/New_York"
  secondsFromGMT: number; // Offset in seconds from GMT
  isDaylightSavingTime: boolean; // Whether DST is currently active
};

Methods

getCurrentTimeZone(): CurrentTimezone

Returns the current timezone information.

getSupportedTimeZones(): string[]

Returns an array of all supported timezone identifiers.

onTimezoneChange: EventEmitter<CurrentTimezone>

Event emitter that fires when the device timezone changes.

Hook

useTimezoneHermesFix(): { currentTimezone: string }

React hook that automatically updates when the timezone changes.

🧪 Example App

A complete example app is included in the repository. To run it:

# Clone the repository
git clone https://github.com/callstack/timezone-hermes-fix.git
cd timezone-hermes-fix

# Install dependencies
yarn

# Run on iOS
yarn example ios

# Run on Android
yarn example android

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

This project is licensed under the MIT License. See LICENSE for details.

Made with ❤️ at Callstack

@callstack/timezone-hermes-fix is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. Callstack is a group of React and React Native geeks, contact us at [email protected] if you need any help with these or just want to say hi!