
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
timezone-codes
Advanced tools
[DEPRECATED] A comprehensive, typed dataset of IANA timezone identifiers with metadata.
This package is no longer maintained.
Please use a better maintained alternative instead. See: https://www.npmjs.com/package/a better maintained alternative
Original README below:
A comprehensive, typed dataset of IANA timezone identifiers with metadata. This library provides a complete list of IANA timezone names along with their standard UTC offsets, common abbreviations, and regions. Perfect for datetime pickers, global dashboards, scheduling apps, and localization engines.
npm install timezone-codes
import { timezones, getTimezoneByName } from 'timezone-codes';
// Access the complete timezone list
console.log(timezones);
// Get a specific timezone
const newYork = getTimezoneByName('America/New_York');
console.log(newYork);
// {
// name: 'America/New_York',
// standardUtcOffset: '-05:00',
// standardAbbreviation: 'EST',
// region: 'America'
// }
The package includes a CLI tool that can be used to quickly look up timezone information:
npx timezone-codes America/New_York
Output:
Timezone: America/New_York
Region: America
Standard UTC Offset: -05:00
Standard Abbreviation: EST
Current UTC Offset: -04:00
Current Abbreviation: EDT
import {
getTimezonesByRegion,
getStandardUtcOffset,
isValidTimezoneName,
getCurrentTimezoneDetails,
} from 'timezone-codes';
// Get all timezones in a region
const europeTimezones = getTimezonesByRegion('Europe');
console.log(europeTimezones);
// Get standard UTC offset
const offset = getStandardUtcOffset('Asia/Tokyo');
console.log(offset); // '+09:00'
// Check if a timezone name is valid
const isValid = isValidTimezoneName('America/New_York');
console.log(isValid); // true
// Get current timezone details (including DST)
const details = await getCurrentTimezoneDetails('America/New_York');
console.log(details);
// {
// currentUtcOffset: '-04:00', // During DST
// currentAbbreviation: 'EDT' // During DST
// }
type IANATimezoneName = string; // e.g., 'America/New_York'
type TimezoneAbbreviation = string; // e.g., 'EST', 'JST'
type UTCOffset = string; // e.g., '-05:00', '+09:00'
type TimezoneRegion = string; // e.g., 'America', 'Asia'
interface Timezone {
name: IANATimezoneName;
standardUtcOffset: UTCOffset;
standardAbbreviation: TimezoneAbbreviation;
region: TimezoneRegion;
}
interface CurrentTimezoneDetails {
currentUtcOffset: UTCOffset;
currentAbbreviation: TimezoneAbbreviation;
}
timezones: Readonly<Timezone[]>The complete list of timezones with their metadata. This is a readonly array to prevent accidental modifications.
getTimezoneByName(name: IANATimezoneName | string): Timezone | undefinedGets a timezone by its IANA name. Returns undefined if not found.
getTimezonesByRegion(region: TimezoneRegion | string): Timezone[]Gets all timezones in a specific region. Case-insensitive. Returns an empty array if no timezones found.
getStandardUtcOffset(name: IANATimezoneName | string): UTCOffset | undefinedGets the standard UTC offset for a timezone. Returns undefined if not found.
isValidTimezoneName(name: string): booleanChecks if a string is a valid IANA timezone name.
getCurrentTimezoneDetails(name: IANATimezoneName): Promise<CurrentTimezoneDetails | undefined>Gets the current timezone details including DST information. Returns undefined if the timezone is invalid.
The timezone data is sourced from the IANA Time Zone Database and processed to include standard offsets and common abbreviations. The data is embedded directly in the library, ensuring zero runtime dependencies.
Contributions are welcome! Please feel free to submit a Pull Request.
This package follows Semantic Versioning (SemVer).
The package is published to npm automatically through GitHub Actions when a new version tag is pushed. For more detailed information about the release process, see RELEASING.md.
MIT
FAQs
[DEPRECATED] A comprehensive, typed dataset of IANA timezone identifiers with metadata.
The npm package timezone-codes receives a total of 2 weekly downloads. As such, timezone-codes popularity was classified as not popular.
We found that timezone-codes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.