Skip to content

Commit

Permalink
v1.20.0: publish TzDatabase externally
Browse files Browse the repository at this point in the history
  • Loading branch information
Rogier Schouten committed Jul 20, 2015
1 parent 7726aea commit 226f49a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,25 @@ z.offsetForUtc(2014, 1, 1, 12, 59, 59, 0); // offset for a time specified in UTC
z.offsetForZone(2014, 1, 1, 12, 59, 59, 0); // offset for a time specified in Europe/Amsterdam time; returns a Duration object
```
### TzDatabase
The TzDatabase class is a singleton class containing the time zone database. It has methods to query time zone offsets. Also, it provides some aggregate information like 'what is the maximum Daylight Saving Time shift of all zones in the database'?

```javascript
var tc = require("timezonecomplete");

// TzDatabase is a singleton, get at it using the instance() method
var db = tc.TzDatabase.instance();

var duration = db.maxDst(); // maximum DST offet in the database

// Does the zone have daylight saving time
var bool1 = db.hasDst("Europe/Amsterdam"); // true
var bool2 = db.hasDst("UTC"); // false

// For more features, see the docs.

```


### DateTime
The DateTime class is a replacement (although not drop-in) for the Date class. It has a date value and a time zone. It has getters for both UTC date and equivalent time zone time.
Expand Down Expand Up @@ -625,6 +644,9 @@ The version of the included IANA time zone database is 2015e.

## Changelog

### 1.20.0 (2015-07-20)
* Make a TzDatabase class available with general info on all time zones

### 1.19.4 (2015-06-15)
* Upgrade TZ database to 2015e

Expand Down
11 changes: 11 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ export import local = timezone.local;
export import utc = timezone.utc;
export import zone = timezone.zone;

import tzDatabase = require("./tz-database"); tzDatabase;
export import AtType = tzDatabase.AtType;
export import isValidOffsetString = tzDatabase.isValidOffsetString;
export import OnType = tzDatabase.OnType;
export import RuleInfo = tzDatabase.RuleInfo;
export import ToType = tzDatabase.ToType;
export import Transition = tzDatabase.Transition;
export import TzDatabase = tzDatabase.TzDatabase;
export import ZoneInfo = tzDatabase.ZoneInfo;


import globals = require("./globals"); globals;
export import min = globals.min;
export import max = globals.max;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "timezonecomplete",
"version": "1.19.4",
"version": "1.20.0",
"description": "DateTime, TimeZone, Duration and Period library aimed at providing a consistent and complete date-time interface, away from the original JavaScript Date class.",
"keywords": [
"Date",
Expand Down

0 comments on commit 226f49a

Please sign in to comment.