IANA TZ Database for Backward UTC Zones
The `tzdata-backward-utc` package provides a specialized subset of the IANA Time Zone Database, specifically containing old synonyms for `Etc/UTC` and `Etc/GMT` zones, represented as a single JSON file. Maintained by Rogier Schouten, this package is part of a larger ecosystem of `tzdata` modules designed to offer granular access to time zone data. Its current stable version is `1.0.48`, updated to IANA TZ database version `2026a`, and it generally follows the release cadence of the upstream IANA TZ database, typically updating every few months to reflect the latest time zone rules, such as recent changes for Kazakhstan or Palestine. Key differentiators include its focus on a very specific historical subset of time zone data and its direct provision of the raw IANA data as a machine-readable JSON object, primarily intended for consumption by other timezone processing libraries like `timezonecomplete`, rather than being a timezone calculation library itself.
Common errors
-
TypeError: tzdataBackwardUtc is not defined
cause Attempting to access the browser global variable `tzdataBackwardUtc` in a Node.js environment.fixIn Node.js, use `const data = require('tzdata-backward-utc');` to import the module's JSON content. The global variable is only available when the UMD bundle is loaded in a browser. -
Cannot find module 'tzdata-backward-utc'
cause The package has not been installed, or the import path is incorrect.fixEnsure the package is installed using `npm install tzdata-backward-utc` and that the import statement matches the package name exactly. -
SyntaxError: Named export 'tzData' not found. The requested module 'tzdata-backward-utc' does not provide an export named 'tzData'
cause Attempting to use a named import for a module that provides a default export (the JSON object itself) but no named exports.fixUse a default import instead: `import tzData from 'tzdata-backward-utc';` for ESM, or `const tzData = require('tzdata-backward-utc');` for CommonJS.
Warnings
- breaking The IANA Time Zone Database, which this package mirrors, is updated periodically to reflect changes in political time zone boundaries, UTC offsets, and daylight-saving rules. These are data changes, not API changes, but they directly affect time calculations for historical or future dates.
- gotcha This package is a specific subset of the IANA TZ database, containing only old synonyms for `Etc/UTC` and `Etc/GMT`. It does not provide comprehensive time zone data for all regions globally. Using it in isolation for general time zone handling will lead to incomplete or incorrect results.
- gotcha This module lists `tzdata-etcetera` as a peer dependency. While npm 7+ handles peer dependencies automatically, older npm versions (or other package managers) might require manual installation, or incorrect installation could lead to missing data links.
Install
-
npm install tzdata-backward-utc -
yarn add tzdata-backward-utc -
pnpm add tzdata-backward-utc
Imports
- jsonData
import jsonData from 'tzdata-backward-utc';
const jsonData = require('tzdata-backward-utc'); - tzdataBackwardUtc
const data = tzdataBackwardUtc;
<!-- In browser HTML --> <script src="./tzdata-backward-utc.js"></script> <script> var data = tzdataBackwardUtc; </script>
- tzData
import { tzData } from 'tzdata-backward-utc';import tzData from 'tzdata-backward-utc';
Quickstart
const backwardUtcData = require('tzdata-backward-utc');
console.log('Loaded backward-utc timezone data (truncated):');
console.log(Object.keys(backwardUtcData).slice(0, 5).map(key => `${key}: ${JSON.stringify(backwardUtcData[key]).slice(0, 50)}...`));
// Example of accessing a specific zone, e.g., 'UTC'
const utcZoneInfo = backwardUtcData['UTC'];
if (utcZoneInfo) {
console.log('\nInformation for UTC zone (truncated):');
console.log(JSON.stringify(utcZoneInfo, null, 2).slice(0, 200) + '...');
} else {
console.log('\nUTC zone information not found.');
}
// Demonstrate use of the IANA TZ Database version property (added in v1.0.46)
if (backwardUtcData.version) {
console.log(`\nIANA TZ Database Version: ${backwardUtcData.version}`);
} else {
console.log('\nVersion property not found (older package version).');
}