# zoneinfo

> Library to parse zoneinfo files for use with a wrapper around Date objects.

Latest version **0.1.8** (published 2013-02-20) · 0 weekly downloads

## Install

```sh
npm install zoneinfo
pnpm add zoneinfo
yarn add zoneinfo
bun add zoneinfo
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2013-02-20 |
| First published | 2011-02-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Gregory McWhirter |
| Maintainers | gsmcwhirter |

## Links

- npm: https://www.npmjs.com/package/zoneinfo
- Repository: https://github.com/gsmcwhirter/node-zoneinfo
- npm.io page: https://npm.io/package/zoneinfo

## Dependencies (1)

- [jspack](https://npm.io/package/jspack.md) >= 0.0.1

## Recent versions

- 0.1.8 (latest) — 2013-02-20
- 0.1.7 — 2011-11-08
- 0.1.6 — 2011-09-21
- 0.1.5 — 2011-08-12
- 0.1.4 — 2011-06-05
- 0.1.3 — 2011-05-05
- 0.1.2 — 2011-02-22
- 0.1.1 — 2011-02-22
- 0.1.0 — 2011-02-22

## README

# node-zoneinfo

## Description

This is a project intened to provide zonefile-based timezone supporting Date objects.

## Installation

You can install this through npm:

    npm install zoneinfo

##Usage

An example of usage is as follows:

    var sys = require('util');
    var zoneinfo = require('zoneinfo'),
        TZDate = zoneinfo.TZDate,
        countrycodes = zoneinfo.countrycodes;

    var d = new TZDate();
    sys.puts(d);
    //=> 2010-09-21 03:18:23 GMT
    sys.puts(d.format("Y-m-d"));
    //=> 2010-09-21
    sys.puts(d.getTimezone());
    //=> UTC
    sys.puts(d.getTimezone(true));
    //=> Etc/UTC
    d.setTimezone("America/Denver");
    sys.puts(d);
    //=> 2010-09-20 21:18:23 GMT-0600
    sys.puts(d.getTimezone());
    //=> MDT
    d.setTimezone("America/Los_Angeles");
    sys.puts(d);
    //=> 2010-09-20 20:18:23 GMT-0700
    sys.puts(d.getTimezone());
    //=> PDT
    d.setTimezone("America/Phoenix");
    sys.puts(d);
    //=> 2010-09-20 20:18:23 GMT-0700
    sys.puts(d.getTimezone());
    //=> MST

    zoneinfo.setDefaultTimezone("America/New_York");
    var d = new TZDate("2010-11-08T16:00:00.000Z");
    sys.puts(d);
    //=> 2010-11-08 11:00:00 GMT-0500
    sys.puts(d.getTimezone());
    //=> EST
    d.setTimezone("America/Denver");
    sys.puts(d);
    //=> 2010-11-08 09:00:00 GMT-0700
    sys.puts(d.getTimezone());
    //=> MST
    d.setTimezone("America/Los_Angeles");
    sys.puts(d);
    //=> 2010-11-08 08:00:00 GMT-0800
    sys.puts(d.getTimezone());
    //=> PST
    d.setTimezone("America/Phoenix");
    sys.puts(d);
    //=> 2010-11-08 09:00:00 GMT-0700
    sys.puts(d.getTimezone());
    //=> MST

    sys.puts(sys.inspect(zoneinfo.listTimezones()));
    //=> [array of all timezones on the system]
    sys.puts(sys.inspect(zoneinfo.listTimezones("US")));
    //=> [array of all US timezones on the system]

    sys.puts(sys.inspect(countrycodes));
    //=> [object of Name: Code pairs]

## Tests

Tests that exist are written for Expresso (http://visionmedia.github.com/expresso/).
To run them, install expresso and then run

    expresso

Alternatively, you can run

    expresso test/index.js

---
_Source: https://npm.io/package/zoneinfo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
