IANA Time Zone Database (Etc. Zones)
The `tzdata-etcetera` package provides a specific subset of the IANA Time Zone Database, focusing exclusively on the 'etcetera' zones such as Etc/GMT, Etc/UTC, and GMT. It delivers this data directly as a JSON file, intended for consumption by applications that require up-to-date time zone definitions without needing the entire global dataset. As of version 1.0.48, it incorporates the IANA TZ database release 2026a. The package maintains a regular release cadence, typically updating shortly after new IANA TZ database releases, which occur several times a year to reflect changes in time zone rules globally. This modular approach allows developers to include only the necessary time zone data, minimizing bundle size, and it is often used in conjunction with libraries like `timezonecomplete` for time zone calculations. Its primary differentiator is its granular focus on a specific zone category and its direct JSON output.
Warnings
- breaking The underlying IANA Time Zone Database frequently updates time zone rules (e.g., daylight saving changes, standard time shifts, new zones). While the package API remains stable, the data itself changes, which can alter time calculations for affected regions.
- breaking Version 1.0.45 removed a 'null' timezone entry. Consumers explicitly relying on the presence or structure of a 'null' entry might experience breakage.
- gotcha This package exports raw JSON data, not a module with functions or classes. Attempting to destructure or call methods on the imported data will fail.
Install
-
npm install tzdata-etcetera -
yarn add tzdata-etcetera -
pnpm add tzdata-etcetera
Imports
- tzdataEtcetera
import jsonData from 'tzdata-etcetera';
var jsonData = require('tzdata-etcetera'); - tzdataEtcetera (browser global)
<script src="./tzdata-etcetera.js"></script> <script> function onLoad() { var data = tzdataEtcetera; } </script>
Quickstart
const tzdataEtcetera = require('tzdata-etcetera');
// Example: Accessing data for a specific zone
const gmtPlus5Data = tzdataEtcetera['Etc/GMT+5'];
if (gmtPlus5Data) {
console.log('Etc/GMT+5 data:', gmtPlus5Data);
console.log('Sample rule for Etc/GMT+5:', gmtPlus5Data[0]);
} else {
console.log('Etc/GMT+5 data not found.');
}
// List all zones included in this package
console.log('\nZones included in tzdata-etcetera:');
Object.keys(tzdataEtcetera).forEach(zone => {
console.log(`- ${zone}`);
});