From 2b00d1956d0ad1bb4d815a341d322480bab7f530 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Tue, 2 Feb 2016 21:20:56 +0100 Subject: [PATCH] v1.27.2: Bugfix for zones that have observed DST but no longer do e.g. Asia/Tokyo zone (issue #22) --- README.md | 3 +++ doc/classes/_tz_database_.tzdatabase.html | 28 ++++++++++---------- doc/index.html | 10 ++++--- doc/interfaces/_tz_database_.minmaxinfo.html | 8 +++--- doc/modules/_tz_database_.html | 2 +- lib/tz-database.ts | 3 ++- package.json | 2 +- test/test-datetime.ts | 8 ++++++ 8 files changed, 40 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index c2397ad..6e5dd00 100644 --- a/README.md +++ b/README.md @@ -707,6 +707,9 @@ The version of the included IANA time zone database is 2016a. ## Changelog +### 1.27.2 (2016-02-02) +* Bugfix for zones that have observed DST but no longer do e.g. Asia/Tokyo zone (issue #22) + ### 1.27.1 (2016-01-29) * Upgrade timezone database to 2016a diff --git a/doc/classes/_tz_database_.tzdatabase.html b/doc/classes/_tz_database_.tzdatabase.html index 2045cbd..466ecec 100644 --- a/doc/classes/_tz_database_.tzdatabase.html +++ b/doc/classes/_tz_database_.tzdatabase.html @@ -202,7 +202,7 @@

Private _ruleInfoCach
_ruleInfoCache: object
@@ -225,7 +225,7 @@

Private _zoneInfoCach
_zoneInfoCache: object
@@ -393,7 +393,7 @@

getRuleInfos

  • @@ -426,7 +426,7 @@

    getTransitionsDstOffsets

  • @@ -476,7 +476,7 @@

    getTransitionsTotalOffsets

  • @@ -520,7 +520,7 @@

    getZoneInfo

  • @@ -558,7 +558,7 @@

    getZoneInfos

  • @@ -619,7 +619,7 @@

    letterForRule

  • @@ -829,7 +829,7 @@

    parseAtType

  • @@ -858,7 +858,7 @@

    parseOnDay

  • @@ -889,7 +889,7 @@

    parseOnType

  • @@ -918,7 +918,7 @@

    parseOnWeekDay

  • @@ -946,7 +946,7 @@

    parseRuleType

  • @@ -975,7 +975,7 @@

    parseToType

  • diff --git a/doc/index.html b/doc/index.html index 6779062..a6250e3 100644 --- a/doc/index.html +++ b/doc/index.html @@ -705,6 +705,10 @@

    Does timezonecomplete handle

    Current TZ database version:

    The version of the included IANA time zone database is 2016a.

    Changelog

    +

    1.27.2 (2016-02-02)

    +
      +
    • Bugfix for zones that have observed DST but no longer do e.g. Asia/Tokyo zone (issue #22)
    • +

    1.27.1 (2016-01-29)

    • Upgrade timezone database to 2016a
    • @@ -1040,9 +1044,9 @@

      1.0.0 (2014-06-26)

    Contributors

    License

    MIT

    diff --git a/doc/interfaces/_tz_database_.minmaxinfo.html b/doc/interfaces/_tz_database_.minmaxinfo.html index 5842676..0fa56e6 100644 --- a/doc/interfaces/_tz_database_.minmaxinfo.html +++ b/doc/interfaces/_tz_database_.minmaxinfo.html @@ -102,7 +102,7 @@

    maxDstSave

    maxDstSave: number
    @@ -112,7 +112,7 @@

    maxGmtOff

    maxGmtOff: number
    @@ -122,7 +122,7 @@

    minDstSave

    minDstSave: number
    @@ -132,7 +132,7 @@

    minGmtOff

    minGmtOff: number
    diff --git a/doc/modules/_tz_database_.html b/doc/modules/_tz_database_.html index e2a0fcf..a288474 100644 --- a/doc/modules/_tz_database_.html +++ b/doc/modules/_tz_database_.html @@ -192,7 +192,7 @@

    validateData

  • diff --git a/lib/tz-database.ts b/lib/tz-database.ts index 1c3a796..a3fddea 100644 --- a/lib/tz-database.ts +++ b/lib/tz-database.ts @@ -932,7 +932,8 @@ export class TzDatabase { /* istanbul ignore if */ if (!offset) { - throw new Error("No offset found."); + // apparently no longer DST, as e.g. for Asia/Tokyo + offset = Duration.minutes(0); } return offset; diff --git a/package.json b/package.json index 752ad3d..45deba4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "timezonecomplete", - "version": "1.27.1", + "version": "1.27.2", "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", diff --git a/test/test-datetime.ts b/test/test-datetime.ts index 12ee72c..960c39e 100644 --- a/test/test-datetime.ts +++ b/test/test-datetime.ts @@ -1635,6 +1635,14 @@ describe("DateTime", (): void => { expect(datetimeFuncs.UTC_MILLIS_CACHE.size()).to.be.lessThan(datetimeFuncs.UTC_MILLIS_CACHE.MAX_CACHE_SIZE + 1); }); }); + + describe("issue #22", (): void => { + it("should not crash", (): void => { + var arrivalTime = new DateTime(2016, 2, 12, 11, 0, 0, 0, TimeZone.zone("Asia/Tokyo")); + arrivalTime = arrivalTime.add(Duration.days(1)); + expect(arrivalTime.toString()).to.equal("2016-02-13T11:00:00.000 Asia/Tokyo"); + }); + }); });