{"id":16561,"library":"tzdata-europe","title":"IANA TZ Database for Europe","description":"The `tzdata-europe` package provides a specific subset of the IANA Time Zone Database, specifically the data found in the 'europe' file, formatted as a JavaScript object that can be directly consumed as JSON. Its current stable version is `1.0.48`, which encapsulates the IANA TZ Database version `2026a`. The package maintains a frequent release cadence, typically updating multiple times per year to align with the latest IANA TZ database releases (e.g., `202Xb`, `202Xc`). This module is not a standalone time zone manipulation library but rather a data provider, intended to be consumed by other libraries like `timezonecomplete` for actual time zone operations. Its key differentiator is providing only the European zones, allowing for smaller bundle sizes in applications that don't need the full global dataset.","status":"active","version":"1.0.48","language":"javascript","source_language":"en","source_url":"https://github.com/rogierschouten/tzdata-generate","tags":["javascript"],"install":[{"cmd":"npm install tzdata-europe","lang":"bash","label":"npm"},{"cmd":"yarn add tzdata-europe","lang":"bash","label":"yarn"},{"cmd":"pnpm add tzdata-europe","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Recommended for performing actual time zone operations using this data; this package only provides the raw data.","package":"timezonecomplete","optional":true}],"imports":[{"note":"The package exports the raw JSON data directly as its default CommonJS export for Node.js and CommonJS-compatible environments.","symbol":"Time Zone Data (CommonJS)","correct":"const europeTimezones = require('tzdata-europe');"},{"note":"Although primarily a CommonJS module, Node.js's interoperability allows for default ESM imports. The data object is the default export, not a named export.","wrong":"import { europeTimezones } from 'tzdata-europe';","symbol":"Time Zone Data (ESM)","correct":"import europeTimezones from 'tzdata-europe';"},{"note":"When used directly in a browser via a script tag, the UMD build exposes the data as a global variable `tzdataEurope`. It does not support standard browser module imports.","wrong":"import tzdataEurope from 'tzdata-europe'","symbol":"tzdataEurope Global (Browser)","correct":"<script src=\"./node_modules/tzdata-europe/tzdata-europe.js\"></script>\n<script>\n  const europeTimezones = tzdataEurope;\n</script>"}],"quickstart":{"code":"const europeTimezones = require('tzdata-europe');\n\n// The entire European time zone database is loaded as a JavaScript object.\n// Each key is an IANA time zone identifier (e.g., 'Europe/London').\n// The value is an object containing details like name, transitions, and rules.\n\n// Access a specific time zone entry, for example, 'Europe/Paris'\nconst parisData = europeTimezones['Europe/Paris'];\n\nif (parisData) {\n  console.log('Successfully loaded data for Europe/Paris:');\n  console.log(`Zone Name: ${parisData.name}`);\n  console.log(`Number of transitions: ${parisData.transitions.length}`);\n} else {\n  console.log('Europe/Paris data not found (this should not happen for valid zones).');\n}\n\n// You can iterate over all available zones in this package:\nconsole.log('\\nTotal number of European zones in this package:', Object.keys(europeTimezones).length);\n\n// Example: Find a zone that uses a specific base offset (e.g., UTC+1)\nconst zonesAtUTCPlusOne = Object.keys(europeTimezones).filter(zoneId => {\n  const zone = europeTimezones[zoneId];\n  // This is a simplified check; actual offset calculation needs a full TZ library\n  // For demonstration, let's just check if it has a common 'offset' property for simplicity.\n  // (Note: The actual data structure is more complex and involves 'transitions'.)\n  return zone.transitions && zone.transitions[0] && zone.transitions[0].offset === 3600; // Example: 3600 seconds for UTC+1\n});\nconsole.log('\\nZones that potentially start at UTC+1 (simplified check):', zonesAtUTCPlusOne.slice(0, 5).join(', ') + (zonesAtUTCPlusOne.length > 5 ? '...' : ''));","lang":"javascript","description":"Demonstrates how to load the European time zone data using CommonJS in Node.js, access specific zone information, and perform basic data exploration."},"warnings":[{"fix":"Regularly update the 'tzdata-europe' package to its latest version (e.g., 'npm install tzdata-europe@latest' or 'yarn upgrade tzdata-europe').","message":"The data provided by this package is a snapshot of the IANA TZ database at a specific point in time. Time zone rules can change frequently due to political or geographical reasons. Always ensure you are using a recent version of the package to have the most up-to-date data for accurate time calculations.","severity":"gotcha","affected_versions":"all"},{"fix":"Review code that accesses or iterates over all time zone entries, particularly if it handles edge cases or unexpected zone names. Ensure robustness against missing or removed entries, and adapt to the updated data structure if necessary.","message":"Version 1.0.45 introduced a change by removing a 'null' timezone entry. If previous application logic relied on the presence or specific structure of such an entry, this update might cause unexpected behavior related to missing keys or altered data structures when iterating over all zones.","severity":"breaking","affected_versions":">=1.0.45"},{"fix":"For global time zone support, consider using the main 'tzdata' package or combine multiple regional 'tzdata-*' packages. Always validate the existence of a time zone key (e.g., `if (europeTimezones[zoneId])`) before attempting to use its associated data.","message":"This package contains *only* the data for time zones geographically defined within Europe by the IANA database. Attempting to access non-European time zones (e.g., 'America/New_York' or 'Asia/Tokyo') from this specific package will result in 'undefined' or a missing key, leading to errors if not properly handled.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Run 'npm install tzdata-europe' or 'yarn add tzdata-europe' in your project directory. Ensure your Node.js application is executed in a context where the module is resolvable, typically within the project's root or a subdirectory.","cause":"The package is not installed or the Node.js runtime cannot resolve the module path for CommonJS imports.","error":"Cannot find module 'tzdata-europe'"},{"fix":"Ensure the `<script src=\"./node_modules/tzdata-europe/tzdata-europe.js\"></script>` tag is present in your HTML `<head>` or before any JavaScript code that tries to access `tzdataEurope`. Verify the global variable name is correctly spelled as `tzdataEurope`.","cause":"The UMD script for 'tzdata-europe' was not loaded into the browser's global scope, or it was loaded after the script attempting to use `tzdataEurope`, or the global variable name is misspelled.","error":"europeTimezones is not defined (in browser console)"},{"fix":"Double-check the time zone identifier string (e.g., 'Europe/Berlin') for correctness and ensure it is listed among the zones provided by `tzdata-europe`. If you need global time zone coverage, switch to the full 'tzdata' package.","cause":"You attempted to access properties (like 'transitions') of a time zone that does not exist or was incorrectly referenced within the `europeTimezones` object. This typically occurs when requesting a non-European zone or a misspelled zone identifier.","error":"TypeError: Cannot read properties of undefined (reading 'transitions')"}],"ecosystem":"npm"}